[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Wed Sep 29 15:18:59 CEST 2004


CVS commit by staikos: 

add a shortcut for Add ELOG Entry and make key bindings for extensions
configurable


  M +2 -0      extensionmgr.h   1.4
  M +27 -3     kst.cpp   1.241
  M +6 -16     extensions/elog/elog.cpp   1.14


--- kdeextragear-2/kst/kst/extensionmgr.h  #1.3:1.4
@@ -39,4 +39,6 @@ class ExtensionMgr : QObject {
     void updateExtensions();
 
+    KstExtension *extension(const QString& name) const { return *_registry.find(name); }
+
     void doRegister(const QString& name, KstExtension *inst);
     void unregister(KstExtension *inst);

--- kdeextragear-2/kst/kst/kst.cpp  #1.240:1.241
@@ -312,5 +312,10 @@ void KstApp::initActions() {
   fileQuit->setWhatsThis(i18n("Quit Kst."));
 
+#if 0
+  // KDE 3.3 only
+  fileKeyBindings = KStdAction::keyBindings(guiFactory(), SLOT(slotConfigureKeys()), actionCollection());
+#else
   fileKeyBindings = KStdAction::keyBindings(this, SLOT(slotConfigureKeys()), actionCollection());
+#endif
   fileKeyBindings->setWhatsThis(i18n("Bring up a dialog box\n"
                                      "to configure shortcuts."));
@@ -640,7 +645,26 @@ void KstApp::initActions() {
 
 
-void KstApp::slotConfigureKeys()
-{
-  KKeyDialog::configure( actionCollection(), this );
+void KstApp::slotConfigureKeys() {
+#if 0
+  // KDE 3.3 only:
+  KKeyDialog::configure(actionCollection(), this);
+#else
+  KKeyDialog dlg(true, this);
+  dlg.insert(actionCollection());
+  ExtensionMgr *mgr = ExtensionMgr::self();
+  const QMap<QString, bool>& extensions = mgr->extensions();
+  for (QMap<QString, bool>::ConstIterator it = extensions.begin(); it != extensions.end(); ++it) {
+    if (it.data()) {
+      KXMLGUIClient *gc = dynamic_cast<KXMLGUIClient*>(mgr->extension(it.key()));
+      if (gc) {
+        KActionCollection *ac = gc->actionCollection();
+        if (ac) {
+          dlg.insert(ac);
+        }
+      }
+    }
+  }
+  dlg.configure(true);
+#endif
 }
 

--- kdeextragear-2/kst/kst/extensions/elog/elog.cpp  #1.13:1.14
@@ -34,5 +34,5 @@ K_EXPORT_COMPONENT_FACTORY(kstextension_
 KstELOG::KstELOG(QObject *parent, const char *name, const QStringList& l) : KstExtension(parent, name, l), KXMLGUIClient() {
   new KAction(i18n("&ELOG..."), 0, 0, this, SLOT(doShow()), actionCollection(), "elog_settings_show");
-  new KAction(i18n("Add ELOG Entry..."), "addelogentry", 0, this, SLOT(doEntry()), actionCollection(), "elog_entry_add");
+  new KAction(i18n("Add ELOG Entry..."), "addelogentry", CTRL+ALT+Key_E, this, SLOT(doEntry()), actionCollection(), "elog_entry_add");
   setInstance(app()->instance());
   setXMLFile("kstextension_elog.rc", true);
@@ -46,13 +46,7 @@ KstELOG::KstELOG(QObject *parent, const 
   connect( app(), SIGNAL(ELOGSubmitEntry(const QString&)), this, SLOT(submitEventEntry(const QString&)));
 
-  if( _elogEntry ) {
     _elogEntry->initialize();
-  }
-  if( _elogEventEntry ) {
     _elogEventEntry->initialize();
-  }
-  if( _elogConfiguration ) {
     _elogConfiguration->initialize();
-  }
 }
 
@@ -104,7 +98,5 @@ void KstELOG::submitEventEntry(const QSt
                                  configuration()->submitAsHTML(),
                                  configuration()->suppressEmail());
-  if( pThread ) {
     pThread->start();
-  }
 }
 
@@ -143,7 +135,5 @@ void KstELOG::submitEntry() {  
                                  configuration()->submitAsHTML(),
                                  configuration()->suppressEmail());
-  if( pThread ) {
     pThread->start();
-  }
 }
 





More information about the Kst mailing list