summaryrefslogtreecommitdiffstats
path: root/kfilereplace/kfilereplace.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commite9ae80694875f869892f13f4fcaf1170a00dea41 (patch)
treeaa2f8d8a217e2d376224c8d46b7397b68d35de2d /kfilereplace/kfilereplace.cpp
downloadtdewebdev-e9ae80694875f869892f13f4fcaf1170a00dea41.tar.gz
tdewebdev-e9ae80694875f869892f13f4fcaf1170a00dea41.zip
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/kdewebdev@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kfilereplace/kfilereplace.cpp')
-rw-r--r--kfilereplace/kfilereplace.cpp111
1 files changed, 111 insertions, 0 deletions
diff --git a/kfilereplace/kfilereplace.cpp b/kfilereplace/kfilereplace.cpp
new file mode 100644
index 00000000..a6ade0fe
--- /dev/null
+++ b/kfilereplace/kfilereplace.cpp
@@ -0,0 +1,111 @@
+/***************************************************************************
+ kfilereplace.cpp - KFileReplace shell implementation
+ -------------------
+ begin : Thu Sep 16 14:14:09 2004
+ copyright : (C) 2004 by Andras Mantia <[email protected]>
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
+//kde includes
+#include <kedittoolbar.h>
+#include <klibloader.h>
+#include <klocale.h>
+#include <kkeydialog.h>
+#include <kmessagebox.h>
+
+//app includes
+#include "kfilereplace.h"
+
+KFileReplace::KFileReplace()
+ : KParts::MainWindow(0L, "KFileReplace")
+{
+ KLibFactory *factory = KLibLoader::self()->factory("libkfilereplacepart");
+ if (factory)
+ {
+ m_part = static_cast<KParts::ReadOnlyPart *>(factory->create(this,
+ "kfilereplace_part", "KParts::ReadOnlyPart" ));
+
+ if (m_part)
+ {
+ setCentralWidget(m_part->widget());
+ KStdAction::quit(this, SLOT(close()), actionCollection());
+ KStdAction::keyBindings(this, SLOT(slotConfigureKeys()), actionCollection());
+ KStdAction::configureToolbars(this, SLOT(slotConfigureToolbars()), actionCollection());
+ setStandardToolBarMenuEnabled(true);
+ createGUI(m_part);
+ removeDuplicatedActions();
+ }
+ }
+ else
+ {
+ KMessageBox::error(this, i18n("Could not find the KFileReplace part."));
+ close();
+ return;
+ }
+}
+
+
+KFileReplace::~KFileReplace()
+{
+}
+
+void KFileReplace::openURL(const KURL &url)
+{
+ m_part->openURL(url);
+}
+
+void KFileReplace::slotConfigureKeys()
+{
+ KKeyDialog dlg( false, this );
+ QPtrList<KXMLGUIClient> clients = guiFactory()->clients();
+ for( QPtrListIterator<KXMLGUIClient> it( clients );
+ it.current(); ++it )
+ {
+ dlg.insert( (*it)->actionCollection() );
+ }
+ dlg.configure();
+}
+
+void KFileReplace::slotConfigureToolbars()
+{
+ saveMainWindowSettings(KGlobal::config(), autoSaveGroup());
+ KEditToolbar dlg(factory());
+ connect(&dlg, SIGNAL(newToolbarConfig()),
+ this, SLOT(applyNewToolbarConfig()));
+ dlg.exec();
+}
+
+void KFileReplace::applyNewToolbarConfig()
+{
+ applyMainWindowSettings(KGlobal::config(), autoSaveGroup());
+}
+
+
+void KFileReplace::removeDuplicatedActions()
+{
+ KActionCollection* part_action_collection = m_part->actionCollection();
+ KAction* part_about_action = part_action_collection->action("help_about_kfilereplace");
+ KAction* part_report_action = part_action_collection->action("report_bug");
+ KAction* part_help_action= part_action_collection->action("help_kfilereplace");
+
+ if (!part_about_action || !part_report_action || !part_help_action || !part_action_collection)
+ return;
+
+ QWidget* container = part_about_action->container(0);
+ part_about_action->unplug(container);
+ part_report_action->unplug(container);
+ part_help_action->unplug(container);
+ part_action_collection->remove(part_about_action);
+ part_action_collection->remove(part_report_action);
+ part_action_collection->remove(part_help_action);
+}
+
+#include "kfilereplace.moc"