[Kst] [Bug 87075] ELOG code should be self contained in ELOG extension

Andrew Walker arwalker at sumusltd.com
Mon Oct 25 20:18:50 CEST 2004


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
        
http://bugs.kde.org/show_bug.cgi?id=87075        
arwalker sumusltd com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From arwalker sumusltd com  2004-10-25 20:18 -------
CVS commit by arwalker: 

Enable or disable the ELOG settings in the event monitor entry dialog depending on whether the ELOG extension is, respectively, loaded or not.

CCMAIL: 87075-done bugs kde org


  M +8 -2      kst.cpp   1.249
  M +19 -2     ksteventmonitor_i.cpp   1.26
  M +3 -1      ksteventmonitor_i.h   1.15
  M +2 -0      kstevents.h   1.10
  M +17 -1     extensions/elog/elog.cpp   1.17


--- kdeextragear-2/kst/kst/kst.cpp  #1.248:1.249
 @ -171,5 +171,7  @ KstApp::KstApp(QWidget *parent, const ch
   QTimer::singleShot(0, this, SLOT(updateActions()));
 
-  // Load any extensions
+  //
+  // load any extensions
+  //
   ExtensionMgr *mgr = ExtensionMgr::self();
   mgr->setWindow(this);
 @ -286,5 +288,9  @ void KstApp::EventELOGConfigure() {
 
 void KstApp::customEvent(QCustomEvent *pEvent) {
-  if(pEvent->type() == KstELOGDebugInfoEvent) {
+  if (pEvent->type() == KstELOGAliveEvent) {
+    KstEventMonitorI::globalInstance()->enableELOG();
+  } else if (pEvent->type() == KstELOGDeathEvent) {
+    KstEventMonitorI::globalInstance()->disableELOG();
+  } else if (pEvent->type() == KstELOGDebugInfoEvent) {
     QTextStream *pTextStream = (QTextStream*)pEvent->data();
     (*pTextStream) << KstDebug::self()->text();

--- kdeextragear-2/kst/kst/ksteventmonitor_i.cpp  #1.25:1.26
 @ -152,9 +152,24  @ void KstEventMonitorI::fillEvent(EventMo
 }
 
+
+void KstEventMonitorI::enableELOG() {
+  checkBoxELOGNotify->setEnabled(true);
+  _pushButtonELOGConfigure->setEnabled(true);
+}
+
+
+void KstEventMonitorI::disableELOG() {
+  checkBoxELOGNotify->setEnabled(false);
+  _pushButtonELOGConfigure->setEnabled(false);
+}
+
+
 bool KstEventMonitorI::new_I() {
   QString tag_name = _tagName->text();
   tag_name.replace("<New_Event>", lineEditEquation->text());
 
-  /* verify that the event name is unique */
+  //
+  // verify that the event name is unique
+  //
   if (KST::dataTagNameNotUnique(tag_name)) {
     _tagName->setFocus();
 @ -183,5 +198,7  @ bool KstEventMonitorI::new_I() {
 
 bool KstEventMonitorI::edit_I() {
-  /* verify that the tag name is unique */
+  //
+  // verify that the tag name is unique
+  //
   QString tag_name = _tagName->text();
   DP->writeLock();

--- kdeextragear-2/kst/kst/ksteventmonitor_i.h  #1.14:1.15
 @ -33,4 +33,6  @ class KstEventMonitorI : public EventMon
     bool new_I();
     bool edit_I();
+    void enableELOG();
+    void disableELOG();
 
     static KstEventMonitorI *globalInstance();

--- kdeextragear-2/kst/kst/kstevents.h  #1.9:1.10
 @ -30,4 +30,6  @ class QWidget;
 #define KstELOGAttrsEvent      (QEvent::User + 4)
 #define KstELOGDebugInfoEvent  (QEvent::User + 5)
+#define KstELOGAliveEvent      (QEvent::User + 6)
+#define KstELOGDeathEvent      (QEvent::User + 7)
 
 struct KstELOGCaptureStruct {

--- kdeextragear-2/kst/kst/extensions/elog/elog.cpp  #1.16:1.17
 @ -33,4 +33,6  @ K_EXPORT_COMPONENT_FACTORY(kstextension_
 
 KstELOG::KstELOG(QObject *parent, const char *name, const QStringList& l) : KstExtension(parent, name, l), KXMLGUIClient() {
+  QCustomEvent eventAlive(KstELOGAliveEvent);
+
   new KAction(i18n("&ELOG..."), 0, 0, this, SLOT(doShow()), actionCollection(), "elog_settings_show");
   new KAction(i18n("Add ELOG Entry..."), "addelogentry", CTRL+ALT+Key_E, this, SLOT(doEntry()), actionCollection(), "elog_entry_add");
 @ -50,9 +52,15  @ KstELOG::KstELOG(QObject *parent, const 
   _elogEventEntry->initialize();
   _elogConfiguration->initialize();
+
+  QApplication::sendEvent( (QObject*)app(), (QEvent*)&eventAlive );
 }
 
 
 KstELOG::~KstELOG() {
+  QCustomEvent eventDeath(KstELOGDeathEvent);
+
   if( app() ) {
+    QApplication::sendEvent( (QObject*)app(), (QEvent*)&eventDeath );
+
     if( app()->guiFactory() ) {
       app()->guiFactory()->removeClient(this);
 @ -166,5 +174,13  @ void KstELOG::doShow() {
 void KstELOG::launchBrowser() {
   // FIXME: be able to raise() an existing browser window one day
-  QString url = _elogConfiguration->ipAddress() + ":" + QString::number(_elogConfiguration->portNumber());
+  QString url;
+
+  url = _elogConfiguration->ipAddress() + ":" + QString::number(_elogConfiguration->portNumber());
+  if (!_elogConfiguration->name().isEmpty()) {
+    url += "/";
+    url += _elogConfiguration->name();
+    url += "/";
+  }
+  
   kapp->invokeBrowser(url);
 }



More information about the Kst mailing list