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

List:       kde-core-devel
Subject:    Re: KMail / Styleguide
From:       Christian Gebauer <gebauer () bigfoot ! com>
Date:       2000-08-31 18:35:00
[Download RAW message or body]

Don Sanders wrote:

> > (Configuration <=> Preferences, wrong order and
> > "Show Toolbar", "Show Statusbar", "Configure Keybindings"
> > are missing)
> > Should I send a patch?
> 
> If you like. Are i18n'd versions of those strings in the libs?
Sure, these are all KStdActions.

> Configure keybindings sounds cool.
One line of code ;-)

The toolbars don't remember that they are hidden, but this
is broken in KMainWindow (again). Simon??

The attached patches are for the mainwindow and the composer,
works fine for me.

Christian
-- 
>><< Christian Gebauer >><< gebauer@bigfoot.com >><< ICQ 14916141 >><<
["mainwin.patch" (text/plain)]

Index: kmmainwin.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmmainwin.cpp,v
retrieving revision 1.213
diff -u -3 -p -r1.213 kmmainwin.cpp
--- kmmainwin.cpp	2000/08/30 19:56:09	1.213
+++ kmmainwin.cpp	2000/08/31 18:26:31
@@ -38,6 +38,7 @@
 #include <kaction.h>
 #include <kstdaction.h>
 #include <kedittoolbar.h>
+#include <kkeydialog.h>
 #include <kcharsets.h>
 
 #include "configuredialog.h"
@@ -1276,15 +1277,9 @@ void KMMainWin::setupMenuBar()
   (void) new KAction( i18n("&Send Queued"), 0, this, 
 		      SLOT(slotSendQueued()), actionCollection(), "send_queued");
 
-  (void) new KAction( i18n("Configuration..."), 0, this, 
-		      SLOT(slotSettings()), actionCollection(), "settings" );
-
-  (void) new KAction( i18n("Address &Book..."), "contents", 0, this, 
+  (void) new KAction( i18n("Address &Book..."), "contents", 0, this,
 		      SLOT(slotAddrBook()), actionCollection(), "addressbook" );
 
-  (void) new KAction( i18n("F&ilter Rules..."), 0, this, 
-		      SLOT(slotFilter()), actionCollection(), "filter" );
-
   KStdAction::close( this, SLOT(slotClose()), actionCollection());
   KStdAction::quit( this, SLOT(quit()), actionCollection());
 
@@ -1421,10 +1416,17 @@ void KMMainWin::setupMenuBar()
   mViewMenu->setItemChecked((int)mMsgView->headerStyle(), TRUE);
   mViewMenu->setItemChecked((int)mMsgView->attachmentStyle()+5, TRUE);
 
-  //  KStdAction::configureToolbars(this, SLOT(slotEditToolbars()), actionCollection());
-  (void) new KAction( i18n("Configure Tool&bars..."), 0, this, 
-		      SLOT(slotEditToolbars()), actionCollection(), "config_toolbars" );
   
+  //----- Settings Menu
+  KStdAction::showToolbar(this, SLOT(slotToggleToolBar()), actionCollection());
+  KStdAction::showStatusbar(this, SLOT(slotToggleStatusBar()), actionCollection());
+  KStdAction::keyBindings(this, SLOT(slotEditKeys()), actionCollection());
+  KStdAction::configureToolbars(this, SLOT(slotEditToolbars()), actionCollection());
+  KStdAction::preferences(this, SLOT(slotSettings()), actionCollection());
+  (void) new KAction( i18n("F&ilter Rules..."), 0, this,
+		      SLOT(slotFilter()), actionCollection(), "filter" );
+  
+
   createGUI( "kmmainwin.rc", false );
 
   QObject::connect( guiFactory()->container("file", this), 
@@ -1439,7 +1441,25 @@ void KMMainWin::setupMenuBar()
   conserveMemory();
 }
 
+
 //-----------------------------------------------------------------------------
+
+void KMMainWin::slotToggleToolBar()
+{
+  if(toolBar("mainToolBar")->isVisible())
+    toolBar("mainToolBar")->hide();
+  else
+    toolBar("mainToolBar")->show();
+}
+
+void KMMainWin::slotToggleStatusBar()
+{
+  if (statusBar()->isVisible())
+    statusBar()->hide();
+  else
+    statusBar()->show();
+}
+
 void KMMainWin::slotEditToolbars()
 {
   KEditToolbar dlg(actionCollection(), "kmmainwin.rc");
@@ -1449,6 +1469,12 @@ void KMMainWin::slotEditToolbars()
     createGUI("kmmainwin.rc");
   }
 }
+
+void KMMainWin::slotEditKeys()
+{
+  KKeyDialog::configureKeys(actionCollection(), xmlFile(), true, this);
+}
+
 
 //-----------------------------------------------------------------------------
 void KMMainWin::setupStatusBar()
Index: kmmainwin.h
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmmainwin.h,v
retrieving revision 1.63
diff -u -3 -p -r1.63 kmmainwin.h
--- kmmainwin.h	2000/08/30 19:56:09	1.63
+++ kmmainwin.h	2000/08/31 18:26:31
@@ -90,8 +90,7 @@ public slots:
   /** Change the current folder, select a message in the current folder */
   void slotSelectFolder(KMFolder*);
   void slotSelectMessage(KMMessage*);
-  void slotEditToolbars();
-
+  
 protected:
   void setupMenuBar();
   void setupStatusBar();
@@ -173,7 +172,13 @@ protected slots:
   virtual void updateMessageMenu();
   // Update html and threaded messages preferences in Folder menu.
   virtual void updateFolderMenu();
-  
+
+  // XML-GUI stuff
+  void slotToggleToolBar();
+  void slotToggleStatusBar();
+  void slotEditToolbars();
+  void slotEditKeys();
+
 protected:
   KStatusBar   *mStatusBar;
   KMFolderTree *mFolderTree;
Index: kmmainwin.rc
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmmainwin.rc,v
retrieving revision 1.6
diff -u -3 -p -r1.6 kmmainwin.rc
--- kmmainwin.rc	2000/08/30 14:03:52	1.6
+++ kmmainwin.rc	2000/08/31 18:26:32
@@ -1,4 +1,4 @@
-<!DOCTYPE kpartgui ><kpartgui version="4" name="kmmainwin" >
+<!DOCTYPE kpartgui ><kpartgui version="5" name="kmmainwin" >
  <MenuBar>
   <Menu noMerge="1" name="file" >
    <text>&amp;File</text>
@@ -69,9 +69,7 @@
    <Action name="view_source" />
   </Menu>
   <Menu name="settings" >
-   <Action name="settings" />
    <Action name="filter" />
-   <Action name="config_toolbars" />
   </Menu>
  </MenuBar>
  <ToolBar noMerge="1" name="mainToolBar" fullWidth="true" >

["composer.patch" (text/plain)]

Index: kmcomposerui.rc
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmcomposerui.rc,v
retrieving revision 1.9
diff -u -3 -p -r1.9 kmcomposerui.rc
--- kmcomposerui.rc	2000/08/10 15:27:41	1.9
+++ kmcomposerui.rc	2000/08/31 18:26:07
@@ -1,4 +1,4 @@
-<!DOCTYPE kpartgui ><kpartgui version="2" name="kmcomposer" >
+<!DOCTYPE kpartgui ><kpartgui version="3" name="kmcomposer" >
  <MenuBar>
   <Menu noMerge="1" name="file" >
    <text>&amp;Message</text>
@@ -54,10 +54,9 @@
    <Action name="attach_save" />
    <Action name="attach_properties" />
   </Menu>
-  <Menu noMerge="1" name="settings" >
+  <Menu name="settings" >
    <text>&amp;Settings</text>
    <Action name="setup_spellchecker" />
-   <Action name="options_configure_toolbars" />
   </Menu>
  </MenuBar>
  <ToolBar noMerge="1" name="mainToolBar" fullWidth="true" >
Index: kmcomposewin.cpp
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmcomposewin.cpp,v
retrieving revision 1.239
diff -u -3 -p -r1.239 kmcomposewin.cpp
--- kmcomposewin.cpp	2000/08/29 16:53:20	1.239
+++ kmcomposewin.cpp	2000/08/31 18:26:07
@@ -30,6 +30,7 @@
 #include <kaction.h>
 #include <kstdaction.h>
 #include <kedittoolbar.h>
+#include <kkeydialog.h>
 #include <kdebug.h>
 
 #ifndef KRN
@@ -143,7 +144,6 @@ KMComposeWin::KMComposeWin(KMMessage *aM
 #endif
 {
   //setWFlags( WType_TopLevel | WStyle_Dialog );
-
   mDone = false;
   mGrid = NULL;
   mAtmListBox = NULL;
@@ -179,10 +179,6 @@ KMComposeWin::KMComposeWin(KMMessage *aM
   setupStatusBar();
   setupEditor();
   setupActions();
-  if(mShowToolBar)
-    toolBar()->show();
-  else
-    toolBar()->hide();
 
   connect(&mEdtSubject,SIGNAL(textChanged(const QString&)),
 	  SLOT(slotUpdWinTitle(const QString&)));
@@ -275,7 +271,6 @@ void KMComposeWin::readConfig(void)
 
   config->setGroup("Composer");
   mAutoSign = config->readEntry("signature","auto") == "auto";
-  mShowToolBar = config->readNumEntry("show-toolbar", 1);
   mDefEncoding = config->readEntry("encoding", "base64");
   mShowHeaders = config->readNumEntry("headers", HDR_STANDARD);
   mWordWrap = config->readNumEntry("word-wrap", 1);
@@ -386,7 +381,6 @@ void KMComposeWin::writeConfig(void)
 
   config->setGroup("Composer");
   config->writeEntry("signature", mAutoSign?"auto":"manual");
-  config->writeEntry("show-toolbar", mShowToolBar);
   config->writeEntry("encoding", mDefEncoding);
   config->writeEntry("headers", mShowHeaders);
   config->writeEntry("sticky-transport", mBtnTransport.isChecked());
@@ -732,14 +726,11 @@ void KMComposeWin::setupActions(void)
                                               "confirm_delivery");
   confirmReadAction = new KToggleAction (i18n("Confirm &read"), 0,
                                          actionCollection(), "confirm_read");
-  (void) new KAction (i18n("&Spellchecker..."), 0, this, SLOT(slotSpellcheckConfig()),
-                      actionCollection(), "setup_spellchecker");
 #if defined CHARSETS
   (void) new KAction (i18n("&Charsets..."), 0, this, SLOT(slotConfigureCharsets()),
                       actionCollection(), "charsets");
 #endif
 
-  KStdAction::configureToolbars(this, SLOT(slotEditToolbars()), actionCollection());
   //these are checkable!!!
   allFieldsAction = new KToggleAction (i18n("&All Fields"), 0, this,
                                        SLOT(slotView()),
@@ -800,9 +791,13 @@ void KMComposeWin::setupActions(void)
   (void) new KAction (i18n("Pr&operties..."), 0, this,
                       SLOT(slotAttachProperties()),
                       actionCollection(), "attach_properties");
-
 
-
+  KStdAction::showToolbar(this, SLOT(slotToggleToolBar()), actionCollection());
+  KStdAction::showStatusbar(this, SLOT(slotToggleStatusBar()), actionCollection());
+  KStdAction::keyBindings(this, SLOT(slotEditKeys()), actionCollection());
+  KStdAction::configureToolbars(this, SLOT(slotEditToolbars()), actionCollection());
+  (void) new KAction (i18n("&Spellchecker..."), 0, this, SLOT(slotSpellcheckConfig()),
+                      actionCollection(), "setup_spellchecker");
 
   encryptAction = new KToggleAction (i18n("Encrypt message"),
                                      "pub_key_red", 0,
@@ -1649,15 +1644,6 @@ void KMComposeWin::slotAttachRemove()
 
 
 //-----------------------------------------------------------------------------
-void KMComposeWin::slotToggleToolBar()
-{
-  enableToolBar(KToolBar::Toggle);
-  mShowToolBar = !mShowToolBar;
-  repaint();
-}
-
-
-//-----------------------------------------------------------------------------
 void KMComposeWin::slotFind()
 {
   mEditor->search();
@@ -2355,6 +2341,22 @@ void KMComposeWin::slotSpellcheckConfig(
 }
 
 //-----------------------------------------------------------------------------
+void KMComposeWin::slotToggleToolBar()
+{
+  if(toolBar("mainToolBar")->isVisible())
+    toolBar("mainToolBar")->hide();
+  else
+    toolBar("mainToolBar")->show();
+}
+
+void KMComposeWin::slotToggleStatusBar()
+{
+  if (statusBar()->isVisible())
+    statusBar()->hide();
+  else
+    statusBar()->show();
+}
+
 void KMComposeWin::slotEditToolbars()
 {
   KEditToolbar dlg(actionCollection(), "kmcomposerui.rc");
@@ -2363,6 +2365,11 @@ void KMComposeWin::slotEditToolbars()
   {
     createGUI("kmcomposerui.rc");
   }
+}
+
+void KMComposeWin::slotEditKeys()
+{
+  KKeyDialog::configureKeys(actionCollection(), xmlFile(), true, this);
 }
 
 
Index: kmcomposewin.h
===================================================================
RCS file: /home/kde/kdenetwork/kmail/kmcomposewin.h,v
retrieving revision 1.88
diff -u -3 -p -r1.88 kmcomposewin.h
--- kmcomposewin.h	2000/07/21 05:29:16	1.88
+++ kmcomposewin.h	2000/08/31 18:26:08
@@ -202,7 +202,13 @@ public slots:
 
   void slotSpellcheck(); // Check spelling of text.
   void slotSpellcheckConfig();
+
+  // XML-GUI stuff
+  void slotToggleToolBar();
+  void slotToggleStatusBar();
   void slotEditToolbars();
+  void slotEditKeys();
+  
   void readConfig(void); // Read settings from app's config file.
   
   void slotUpdWinTitle(const QString& ); // Change window title to given string.
@@ -219,9 +225,6 @@ public slots:
   /** Popup a nice "not implemented" message. */
   void slotToDo();
 
-  /** Show/hide toolbar. */
-  void slotToggleToolBar();
-
   /** Open a popup-menu in the attachments-listbox. */
   void slotAttachPopupMenu(QListViewItem *, const QPoint &, int);
 
@@ -358,7 +361,7 @@ protected:
   QListView *mAtmListBox;
   QList<QListViewItem> mAtmItemList;
   KMMsgPartList mAtmList;
-  bool mAutoSign, mAutoPgpSign, mShowToolBar, mAutoDeleteMsg;
+  bool mAutoSign, mAutoPgpSign, mAutoDeleteMsg;
   long mShowHeaders;
   QString mDefEncoding;
 #ifndef KRN


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

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