parts/replace/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
00045 QWhatsThis::add
00046 (m_widget, i18n(
"<b>Replace</b><p>"
00047
"This window shows a preview of a string replace "
00048
"operation. Uncheck a line to exclude that replacement. "
00049
"Uncheck a file to exclude the whole file from the "
00050
"operation. "
00051
"Clicking on a line in the list will automatically "
00052
"open the corresponding source file and set the "
00053
"cursor to the line with the match." ));
00054
00055 mainWindow()->embedOutputView( m_widget, i18n(
"Replace"), i18n(
"Project wide string replacement") );
00056
00057
KAction * action =
new KAction(i18n(
"Find-Select-Replace..."),
"replace project",
00058 CTRL+SHIFT+Key_R,
this, SLOT(slotReplace()), actionCollection(),
"edit_replace_across");
00059 action->setToolTip( i18n(
"Project wide string replacement") );
00060 action->setWhatsThis( i18n(
"<b>Find-Select-Replace</b><p>"
00061
"Opens the project wide string replacement dialog. There you "
00062
"can enter a string or a regular expression which is then "
00063
"searched for within all files in the locations "
00064
"you specify. Matches will be displayed in the <b>Replace</b> window, you "
00065
"can replace them with the specified string, exclude them from replace operation or cancel the whole replace.") );
00066
00067 core()->insertNewAction( action );
00068 }
00069
00070
00071 ReplacePart::~ReplacePart()
00072 {
00073
if (
m_widget )
00074
mainWindow()->
removeView(
m_widget );
00075
delete m_widget;
00076 }
00077
00078 void ReplacePart::slotReplace()
00079 {
00080
m_widget->showDialog();
00081 }
00082
00083
00084
#include "replace_part.moc"
This file is part of the documentation for KDevelop Version 3.0.4.