Bug 87075 - ELOG code should be self contained in ELOG extension
Summary: ELOG code should be self contained in ELOG extension
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-12 22:56 UTC by Rick Chern
Modified: 2004-10-25 20:18 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rick Chern 2004-08-12 22:56:26 UTC
Version:           0.99-devel (using KDE KDE 3.2.1)
Installed from:    Compiled From Sources
OS:                Linux

When the elog extension is disabled, the ELOG checkbox is checkable in the event monitor and the Configure... button is clickable (but does not do anthing.

Wish:
When elog extension is disabled, the ELOG checkbox is not enabled (but existing events should still have the correct checked state) and the Configure... button is not enabled.
Comment 1 George Staikos 2004-08-12 23:04:47 UTC
I'm not sure we have a clean interface for this in the code yet.  We don't want the code to depend too heavily on features in extensions because then they become less of an extension.  On the other hand, it's hard to know where we need to provide places for extensions to "plug into".  This needs a bit of a design meeting I think.
Comment 2 George Staikos 2004-10-19 07:58:16 UTC
The real problem is that the ELOG code in Kst core should be moved into the extension and the extension should have ELOG-independent places to hook into the Kst core.  For instance, hooks in the UI to add optional widgets, event handlers, signals, etc.
Comment 3 Andrew Walker 2004-10-25 20:18:46 UTC
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);
 }