[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    kcontrol patch #5
From:       Carlo Robazza <yoamwmvs () umail ! corel ! com>
Date:       2001-03-26 21:52:30
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi there,

I have five patches to kcontrol that I will be posting to this email
list. I have had to split the work I did into separate patches for each
feature. The original discussion of these features took place in
kde-look but I was asked to post the patches to this list for further
discussion.


Patch #1
------

I have removed the Help tab. Help is still available through each
module's help button. This brings up a dialog box with the help
information.


Patch #2
------

I have removed the Search tab and replaced it with a Search button. The
search button then brings up a dialog box. Unfortunately, the process of
splitting out the patches has slightly broken this feature in that the
search list isn't populated. It worked before and I can't figure out why
it doesn't now. Perhaps someone could take a look at it and figure out
why.


Patch #3
------
I removed the Modules menu as this menu was found to be redundant during
our usability studies. The same list appears in the index tree view.


Patch #4
------

I removed the View menu thereby removing the Icon view mode. The icon
view mode was found to be unintuitive.


Patch #5
------

Display a list of the modules under a category when a category is
selected. This uses a modified AboutWidget that lists the Category and
sub-modules when a category is selected. If a category is selected after
changes were made to a module, the standard message box pops up to let
the user accept or forget their changes. There is one minor bug with
this that I haven't been able to figure out which has to do with
resizing the AboutWidget when a category is selected. If a category is
selected after a module, then the resizing is correct. If a category is
selected on startup or after another category, there is a resizing
problem. However, resizing kcontrol as a whole by dragging an edge
causes a proper resize.


Thanks,

Carlo.
Corel.


[Attachment #5 (text/html)]

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>

<pre>
Hi there,</pre>
I have five patches to kcontrol that I will be posting to this email list.
I have had to split the work I did into separate patches for each feature.
The original discussion of these features took place in kde-look but I
was asked to post the patches to this list for further discussion.
<br>&nbsp;
<p>Patch #1
<br>------
<p>I have removed the Help tab. Help is still available through each module's
help button. This brings up a dialog box with the help information.
<br>&nbsp;
<p>Patch #2
<br>------
<p>I have removed the Search tab and replaced it with a Search button.
The search button then brings up a dialog box. Unfortunately, the process
of splitting out the patches has slightly broken this feature in that the
search list isn't populated. It worked before and I can't figure out why
it doesn't now. Perhaps someone could take a look at it and figure out
why.
<br>&nbsp;
<p>Patch #3
<br>------
<br>I removed the Modules menu as this menu was found to be redundant during
our usability studies. The same list appears in the index tree view.
<br>&nbsp;
<p>Patch #4
<br>------
<p>I removed the View menu thereby removing the Icon view mode. The icon
view mode was found to be unintuitive.
<br>&nbsp;
<p>Patch #5
<br>------
<p>Display a list of the modules under a category when a category is selected.
This uses a modified AboutWidget that lists the Category and sub-modules
when a category is selected. If a category is selected after changes were
made to a module, the standard message box pops up to let the user accept
or forget their changes. There is one minor bug with this that I haven't
been able to figure out which has to do with resizing the AboutWidget when
a category is selected. If a category is selected after a module, then
the resizing is correct. If a category is selected on startup or after
another category, there is a resizing problem. However, resizing kcontrol
as a whole by dragging an edge causes a proper resize.
<br>&nbsp;
<p>Thanks,
<p>Carlo.
<br>Corel.
<br>&nbsp;</html>

["category_listing.diff" (text/plain)]

? category_listing.diff
? kcontrol.vtg
? kcontrol.vpj
? replace_search_tab.diff
? remove_help_tab.diff
? remove_view_menu.diff
? remove_modules_menu.diff
Index: aboutwidget.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/aboutwidget.cpp,v
retrieving revision 1.26
diff -u -w -r1.26 aboutwidget.cpp
--- aboutwidget.cpp	2001/03/17 01:18:15	1.26
+++ aboutwidget.cpp	2001/03/26 20:35:36
@@ -31,6 +31,8 @@
 #include "global.h"
 #include "aboutwidget.h"
 #include "aboutwidget.moc"
+#include "modules.h"
+#include "moduletreeview.h"
 
 const char * title_text = I18N_NOOP("Configure your desktop environment.");
 
@@ -53,9 +55,16 @@
 const char * release_text = I18N_NOOP("Release:");
 const char * machine_text = I18N_NOOP("Machine:");
 
-AboutWidget::AboutWidget(QWidget *parent , const char *name)
-   : QWidget(parent, name)
+AboutWidget::AboutWidget(QWidget *parent , const char *name, QListViewItem* category)
+   : QWidget(parent, name),
+      _moduleList(false),
+      _category(category)
 {
+    if (_category)
+    {
+      _moduleList = true;
+    }
+    
     setMinimumSize(400, 400);
 
     // load images
@@ -166,6 +175,9 @@
     QFont f2 = f1;
     f2.setBold(true);
 
+    
+    if (!_moduleList)
+    {
     // kde version
     p.setFont(f1);
     p.drawText(xoffset, yoffset, i18n(version_text));
@@ -229,4 +241,43 @@
     ut.replace(QRegExp("</b>"), "");
 
     p.drawText(xoffset, yoffset, bwidth, bheight, AlignLeft | AlignVCenter | WordBreak, ut);
+    }
+    else
+    {
+      QFont headingFont = f2;
+      headingFont.setPointSize(headingFont.pointSize()+5);
+      headingFont.setUnderline(true);
+
+      p.setFont(headingFont);
+      p.drawText(xoffset, yoffset, i18n(static_cast<ModuleTreeItem*>(_category)->caption().latin1()));
+      yoffset += fheight + 10;
+
+      // traverse the list
+      QListViewItem* pEntry = _category->firstChild();
+      while (pEntry != NULL)
+        {
+          QString szName;
+          QString szComment;
+          if (static_cast<ModuleTreeItem*>(pEntry)->module())
+            {
+              szName = static_cast<ModuleTreeItem*>(pEntry)->module()->name();
+              szComment = static_cast<ModuleTreeItem*>(pEntry)->module()->comment();
+              p.setFont(f2);
+              p.drawText(xoffset, yoffset, i18n(szName.latin1()));
+              p.setFont(f1);
+              p.drawText(xoffset + xadd, yoffset, i18n(szComment.latin1()));
+            }
+          else
+            {
+              szName = static_cast<ModuleTreeItem*>(pEntry)->caption();
+              p.setFont(f2);
+              p.drawText(xoffset, yoffset, i18n(szName.latin1()));
+            }
+
+          yoffset += fheight + 5;
+          if(yoffset > bheight) return;
+          
+          pEntry = pEntry->nextSibling();
+        }
+      }
 }
Index: aboutwidget.h
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/aboutwidget.h,v
retrieving revision 1.7
diff -u -w -r1.7 aboutwidget.h
--- aboutwidget.h	2001/03/17 01:18:15	1.7
+++ aboutwidget.h	2001/03/26 20:35:36
@@ -22,13 +22,14 @@
 
 #include <qwidget.h>
 #include <qpixmap.h>
+#include <qlistview.h>
 
 class AboutWidget : public QWidget
 {  
   Q_OBJECT    
   
 public:   
-  AboutWidget(QWidget *parent, const char *name=0);	
+  AboutWidget(QWidget *parent, const char *name=0, QListViewItem* category=0);	
   
 protected:
     void paintEvent(QPaintEvent*);
@@ -37,6 +38,8 @@
 private:
     QPixmap _part1, _part2, _part3;
     QPixmap _buffer;
+    bool    _moduleList;
+    QListViewItem* _category;
 };
 
 #endif
Index: dockcontainer.h
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/dockcontainer.h,v
retrieving revision 1.11
diff -u -w -r1.11 dockcontainer.h
--- dockcontainer.h	2001/03/17 01:18:15	1.11
+++ dockcontainer.h	2001/03/26 20:35:36
@@ -36,8 +36,10 @@
   void setBaseWidget(QWidget *widget);
   void dockModule(ConfigModule *module);
 
-protected slots:
+public slots:
   void removeModule();
+
+protected slots:
   void quickHelpChanged();
 
 protected:
Index: indexwidget.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/indexwidget.cpp,v
retrieving revision 1.15
diff -u -w -r1.15 indexwidget.cpp
--- indexwidget.cpp	2001/03/17 01:18:15	1.15
+++ indexwidget.cpp	2001/03/26 20:35:36
@@ -18,6 +18,7 @@
 */                                                                            
 
 #include <qlayout.h>
+#include <qlistview.h>
 
 #include <kglobal.h>
 #include <klocale.h>
@@ -39,6 +40,8 @@
   _tree->fill();
   connect(_tree, SIGNAL(moduleSelected(ConfigModule*)), 
 		  this, SLOT(moduleSelected(ConfigModule*)));
+  connect(_tree, SIGNAL(categorySelected(QListViewItem*)), 
+		  this, SIGNAL(categorySelected(QListViewItem*)));
 
   // iconview
   _icon = new ModuleIconView(_modules, this);
Index: indexwidget.h
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/indexwidget.h,v
retrieving revision 1.11
diff -u -w -r1.11 indexwidget.h
--- indexwidget.h	2001/03/17 01:18:15	1.11
+++ indexwidget.h	2001/03/26 20:35:37
@@ -48,6 +48,7 @@
 
 signals:
   void moduleActivated(ConfigModule *module);
+  void categorySelected(QListViewItem *);
 
 protected:
   void resizeEvent(QResizeEvent *e);
Index: moduletreeview.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/moduletreeview.cpp,v
retrieving revision 1.33
diff -u -w -r1.33 moduletreeview.cpp
--- moduletreeview.cpp	2001/03/17 01:18:15	1.33
+++ moduletreeview.cpp	2001/03/26 20:35:37
@@ -201,6 +201,7 @@
      menu->setPixmap(0, SmallIcon(group->icon()));
      menu->setText(0, " " + group->caption());
      menu->setTag(defName);
+     menu->setCaption(group->caption());
   }
   else
   {
@@ -225,6 +226,10 @@
       emit moduleSelected(static_cast<ModuleTreeItem*>(item)->module());
       return;
     }
+  else
+    {
+      emit categorySelected(item);
+    }
 
   setOpen(item, !item->isOpen());
 
Index: moduletreeview.h
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/moduletreeview.h,v
retrieving revision 1.8
diff -u -w -r1.8 moduletreeview.h
--- moduletreeview.h	2001/03/17 01:18:15	1.8
+++ moduletreeview.h	2001/03/26 20:35:37
@@ -41,13 +41,16 @@
  
 
   void setTag(const QString& tag) { _tag = tag; }
+  void setCaption(const QString& caption) { _caption = caption; }
   void setModule(ConfigModule *m) { _module = m; }
   QString tag() const { return _tag; };
+  QString caption() const { return _caption; };
   ConfigModule *module() { return _module; };
 
 private:
   ConfigModule *_module;
   QString       _tag;
+  QString       _caption;
 
 };
 
@@ -64,6 +67,7 @@
 
 signals:
   void moduleSelected(ConfigModule*);
+  void categorySelected(QListViewItem*);
 
 protected slots:
   void slotItemSelected(QListViewItem*);
Index: toplevel.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/toplevel.cpp,v
retrieving revision 1.82
diff -u -w -r1.82 toplevel.cpp
--- toplevel.cpp	2001/03/17 01:18:15	1.82
+++ toplevel.cpp	2001/03/26 20:35:37
@@ -25,6 +25,7 @@
 #include <kdebug.h>
 #include <kbugreport.h>
 #include <kaboutdata.h>
+#include <kmessagebox.h>
 
 #include <qhbox.h>
 #include <qtabwidget.h>
@@ -99,6 +100,9 @@
                   this, SLOT(moduleActivated(ConfigModule*)));
   _tab->addTab(_indextab, i18n("In&dex"));
 
+  connect(_indextab, SIGNAL(categorySelected(QListViewItem*)),
+                  this, SLOT(categorySelected(QListViewItem*)));
+
   // search tab
   _searchtab = new SearchWidget(_tab);
   _searchtab->populateKeywordList(_modules);
@@ -309,6 +313,38 @@
     _active=module;
     activateModule(module->fileName());
 }
+
+void TopLevel::categorySelected(QListViewItem *category)
+{
+  if (_active)
+  {
+    if (_active->isChanged())
+      {
+        int res = KMessageBox::warningYesNo(this, _active ?
+                            i18n("There are unsaved changes in the "
+                                 "active module.\n"
+                                 "Do you want to apply the changes "
+                                 "before running\n"
+                                 "the new module or forget the changes?") :
+                            i18n("There are unsaved changes in the "
+                                 "active module.\n"
+                                 "Do you want to apply the changes "
+                                 "before exiting\n"
+                                 "the Control Center or forget the changes?"),
+                            i18n("Unsaved changes"),
+                            i18n("&Apply"),
+                            i18n("&Forget"));
+        if (res == KMessageBox::Yes)
+          _active->module()->applyClicked();
+      }
+  }
+  _dock->removeModule();
+  
+  // insert the about widget
+  AboutWidget *aw = new AboutWidget(this, 0L, category);
+  _dock->setBaseWidget(aw);
+}
+
 
 void TopLevel::showModule(QString desktopFile)
 {
Index: toplevel.h
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kcontrol/toplevel.h,v
retrieving revision 1.29
diff -u -w -r1.29 toplevel.h
--- toplevel.h	2001/03/17 01:18:15	1.29
+++ toplevel.h	2001/03/26 20:35:37
@@ -22,7 +22,9 @@
 #define __TOPLEVEL_H__
 
 #include <kmainwindow.h>
+#include <qlistview.h>
 
+
 class QTabWidget;
 
 class KToggleAction;
@@ -51,6 +53,7 @@
 protected slots:
   void activateModule(const QString& name);
   void moduleActivated(ConfigModule *module);
+  void categorySelected(QListViewItem *category);
   void newModule(const QString &name, const QString& docPath, const QString &quickhelp);
   void activateIconView();
   void activateTreeView();


-- 
The address in the headers is not the poster's real email address.  Do not send
private mail to the poster using your mailer's "reply" feature.  CC's of mail 
to mailing lists are OK.  Problem reports to "postmaster@umail.corel.com".  
The poster's email address is "carlor@corel.com".


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic