From 114a878c64ce6f8223cfd22d76a20eb16d177e5e Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- parts/quickopen/quickopen_part.cpp | 139 +++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 parts/quickopen/quickopen_part.cpp (limited to 'parts/quickopen/quickopen_part.cpp') diff --git a/parts/quickopen/quickopen_part.cpp b/parts/quickopen/quickopen_part.cpp new file mode 100644 index 00000000..dbfab9e6 --- /dev/null +++ b/parts/quickopen/quickopen_part.cpp @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2003 Roberto Raggi (roberto@kdevelop.org) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#include "quickopen_part.h" +#include "quickopenclassdialog.h" +#include "quickopenfunctiondialog.h" +#include "quickopenfiledialog.h" + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include "kdeveditorutil.h" + +typedef KDevGenericFactory QuickOpenFactory; +static const KDevPluginInfo data("kdevquickopen"); +K_EXPORT_COMPONENT_FACTORY( libkdevquickopen, QuickOpenFactory( data ) ) + +using namespace KTextEditor; + +QuickOpenPart::QuickOpenPart(QObject *parent, const char *name, const QStringList& ) + : KDevQuickOpen(&data, parent, name ? name : "QuickOpenPart" ) +{ + setInstance(QuickOpenFactory::instance()); + setXMLFile("kdevpart_quickopen.rc"); + + m_actionQuickOpen = new KAction( i18n("Quick Open File..."), CTRL + ALT + Key_O, + this, SLOT(slotQuickFileOpen()), + actionCollection(), "quick_open" ); + m_actionQuickOpen->setToolTip(i18n("Quick open file in project")); + m_actionQuickOpen->setWhatsThis(i18n("Quick open

Provides a file name input form with completion listbox to quickly open file in a project.")); + + m_actionQuickOpenClass = new KAction( i18n("Quick Open Class..."), CTRL + ALT + Key_C, + this, SLOT(slotQuickOpenClass()), + actionCollection(), "quick_open_class" ); + m_actionQuickOpenClass->setToolTip(i18n("Find class in project")); + m_actionQuickOpenClass->setWhatsThis(i18n("Find class

Provides a class name input form with completion listbox to quickly open a file where the class is defined.")); + + m_actionFunctionOpen = new KAction( i18n("Quick Open Method..."), CTRL + ALT + Key_M, this, SLOT(slotQuickOpenFunction()), actionCollection(), "quick_open_function" ); + m_actionFunctionOpen->setToolTip(i18n("Quick open function in project")); + + m_switchToAction = new KAction(i18n("Switch To..."), KShortcut("CTRL+/"), this, SLOT(slotSwitchTo()), actionCollection(), "file_switchto"); + m_switchToAction->setToolTip(i18n("Switch to")); + m_switchToAction->setWhatsThis(i18n("Switch to

Prompts to enter the name of previously opened file to switch to.")); + + connect( core(), SIGNAL(projectOpened()), this, SLOT(slotProjectOpened()) ); + connect( core(), SIGNAL(projectClosed()), this, SLOT(slotProjectClosed()) ); +} + + +QuickOpenPart::~QuickOpenPart() +{ +} + +void QuickOpenPart::slotProjectOpened( ) +{ +} + +void QuickOpenPart::slotProjectClosed( ) +{ +} + +void QuickOpenPart::slotQuickFileOpen( ) +{ + QuickOpenFileDialog dlg( this, mainWindow()->main() ); + dlg.exec(); +} + +void QuickOpenPart::slotQuickOpenClass( ) +{ + QuickOpenClassDialog dlg( this, mainWindow()->main() ); + dlg.nameEdit->setText( KDevEditorUtil::currentWord( dynamic_cast( partController()->activePart() ) ) ); + dlg.exec(); +} + +void QuickOpenPart::slotQuickOpenFunction() +{ + QuickOpenFunctionDialog dlg( this, mainWindow()->main() ); + dlg.nameEdit->setText( KDevEditorUtil::currentWord( dynamic_cast( partController()->activePart() ) ) ); + dlg.exec(); +} + +void QuickOpenPart::slotSwitchTo() +{ + QuickOpenFileDialog dlg( this, partController()->openURLs(), mainWindow()->main() ); + dlg.exec(); +} + +void QuickOpenPart::selectItem( ItemDom item ) +{ + Extensions::KDevCodeBrowserFrontend* f = extension< Extensions::KDevCodeBrowserFrontend > ( "KDevelop/CodeBrowserFrontend" ); + + if(f != 0) { + ItemDom itemDom( &(*item) ); + f->jumpedToItem( itemDom ); + } else { + kdDebug() << "could not find the proper extension\n"; + } +} + +void QuickOpenPart::quickOpenFile(const KURL::List urls) +{ + QuickOpenFileDialog dlg( this, urls, mainWindow()->main() ); + dlg.exec(); +} + + +#include "quickopen_part.moc" -- cgit v1.2.1