replace_part.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <qwhatsthis.h>
00013
00014 #include <kaction.h>
00015 #include <kiconloader.h>
00016 #include <klocale.h>
00017
00018 #include <kdevgenericfactory.h>
00019 #include <kdebug.h>
00020 #include <kiconloader.h>
00021
00022 #include <kdevcore.h>
00023 #include <kdevmainwindow.h>
00024
00025 #include "replace_widget.h"
00026 #include "replace_part.h"
00027
00028 static const KAboutData data("kdevreplace", I18N_NOOP("Replace"), "1.0");
00029
00030
00031
00032
00033 typedef KDevGenericFactory<ReplacePart> ReplaceFactory;
00034 K_EXPORT_COMPONENT_FACTORY(libkdevreplace, ReplaceFactory(&data))
00035
00036 ReplacePart::ReplacePart(QObject *parent, const char *name, const QStringList& )
00037 : KDevPlugin( "Project Wide Replace", "", parent, name ? name : "ReplacePart" )
00038 {
00039 setInstance(ReplaceFactory::instance());
00040 setXMLFile("kdevpart_replace.rc");
00041
00042 m_widget = new ReplaceWidget(this);
00043 m_widget->setIcon( SmallIcon("filefind") );
00044 m_widget->setCaption(i18n("Replace"));
00045
00046 QWhatsThis::add
00047 (m_widget, i18n("<b>Replace</b><p>"
00048 "This window shows a preview of a string replace "
00049 "operation. Uncheck a line to exclude that replacement. "
00050 "Uncheck a file to exclude the whole file from the "
00051 "operation. "
00052 "Clicking on a line in the list will automatically "
00053 "open the corresponding source file and set the "
00054 "cursor to the line with the match." ));
00055
00056 mainWindow()->embedOutputView( m_widget, i18n("Replace"), i18n("Project wide string replacement") );
00057
00058 KAction * action = new KAction(i18n("Find-Select-Replace..."), "replace project",
00059 CTRL+SHIFT+Key_R, this, SLOT(slotReplace()), actionCollection(), "edit_replace_across");
00060 action->setToolTip( i18n("Project wide string replacement") );
00061 action->setWhatsThis( i18n("<b>Find-Select-Replace</b><p>"
00062 "Opens the project wide string replacement dialog. There you "
00063 "can enter a string or a regular expression which is then "
00064 "searched for within all files in the locations "
00065 "you specify. Matches will be displayed in the <b>Replace</b> window, you "
00066 "can replace them with the specified string, exclude them from replace operation or cancel the whole replace.") );
00067
00068 core()->insertNewAction( action );
00069 }
00070
00071
00072 ReplacePart::~ReplacePart()
00073 {
00074 if ( m_widget )
00075 mainWindow()->removeView( m_widget );
00076 delete m_widget;
00077 }
00078
00079 void ReplacePart::slotReplace()
00080 {
00081 m_widget->showDialog();
00082 }
00083
00084
00085 #include "replace_part.moc"
This file is part of the documentation for KDevelop Version 3.1.2.