KDevelop API Documentation

closer_part.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2003 by Jens Dagerbo                                    *
00003  *   jens.dagerbo@swipnet.se                                               *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  ***************************************************************************/
00011 
00012 #include <qdialog.h>
00013 #include <qstringlist.h>
00014 #include <qstring.h>
00015 
00016 #include <kiconloader.h>
00017 #include <klocale.h>
00018 #include <kdevgenericfactory.h>
00019 #include <kaction.h>
00020 #include <kdebug.h>
00021 #include <kdevpartcontroller.h>
00022 #include <kparts/part.h>
00023 #include <kdevproject.h>
00024 #include <kdevcore.h>
00025 #include <kdevmainwindow.h>
00026 
00027 #include "closer_part.h"
00028 #include "closer_dialogimpl.h"
00029 
00030 static const KAboutData data("kdevcloser", I18N_NOOP("Close Selected Windows..."), "1.0");
00031 
00032 typedef KDevGenericFactory<CloserPart> CloserFactory;
00033 K_EXPORT_COMPONENT_FACTORY( libkdevcloser, CloserFactory( &data ) )
00034 
00035 CloserPart::CloserPart(QObject *parent, const char *name, const QStringList& )
00036     : KDevPlugin("Selected Window Closer", "closer", parent, name ? name : "closerPart" )
00037 {
00038     setInstance(CloserFactory::instance());
00039     setXMLFile("kdevpart_closer.rc");
00040 
00041     KAction * action = new KAction( i18n("Close Selected Windows..."), CTRL+ALT+Key_W, this,
00042         SLOT( openDialog() ), actionCollection(), "closer" );
00043     action->setToolTip( i18n("Select windows to close") );
00044     action->setWhatsThis(i18n("<b>Close selected windows</b><p>Provides a dialog to select files which will be closed."));
00045 
00046     core()->insertNewAction( action );
00047 }
00048 
00049 
00050 CloserPart::~CloserPart()
00051 {}
00052 
00053 void CloserPart::openDialog()
00054 {
00055     CloserDialogImpl d( partController()->openURLs() );
00056     if ( d.exec() == QDialog::Accepted )
00057     {
00058         partController()->closeFiles( d.getCheckedFiles() );
00059     }
00060 }
00061 #include "closer_part.moc"
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 22 09:22:38 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003