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

List:       koffice-devel
Subject:    [PATCH] KConfig XT and koshell
From:       Sven_Lüppken <sven () kde ! org>
Date:       2005-02-18 21:01:45
Message-ID: 421657B9.5050004 () kde ! org
[Download RAW message or body]

Hi all!

While trying to fix the bugs #63529 and #65718 (which _are_ actually 
fixed with the attached patch IMHO) I had the idea that it would be nice 
if koshell would remember the latest user setting of the sidebar-size so 
I tried to add support for KConfig XT...sadly it doesn't work correctly. 
Only the standard size is loaded and not the one I saved.

Can anybody help me with that KConfig XT stuff? :) There's some mistake 
I don't see at the moment :}

Regards,
Sven Lüppken
sven@kde.org

["koshell.kcfg" (text/xml)]

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE kcfg SYSTEM "http://www.kde.org/standards/kcfg/1.0/kcfg.dtd"> 
<kcfg> 
<kcfgfile name="koshellrc"/>
  <group name="koshell">
    <entry name="SidebarWidth" type="Int"> 
      <label>Defines the width of the sidebar.</label>
      <default>80</default>
    </entry>
  </group>
</kcfg>
["koshellsettings.kcfgc" (text/plain)]

File=koshell.kcfg
ClassName=KoShellSettings
Singleton=true
Mutators=true
["koshell2.patch" (text/x-patch)]

? Doxyfile
? koshell.kcfg
? koshell.kdevelop
? koshell.kdevelop.pcs
? koshell.kdevses
? koshellsettings.kcfgc
Index: Makefile.am
===================================================================
RCS file: /home/kde/koffice/koshell/Makefile.am,v
retrieving revision 1.28
diff -u -3 -p -r1.28 Makefile.am
--- Makefile.am	2 Jan 2004 22:33:58 -0000	1.28
+++ Makefile.am	18 Feb 2005 20:42:02 -0000
@@ -5,9 +5,10 @@ INCLUDES  = $(KOFFICE_INCLUDES) $(all_in
 lib_LTLIBRARIES = 
 kdeinit_LTLIBRARIES = koshell.la
 bin_PROGRAMS =
-koshell_la_SOURCES = koshell_main.cc koshell_shell.cc
+koshell_la_SOURCES = koshell_main.cc koshell_shell.cc koshellsettings.kcfgc
 koshell_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
 koshell_la_LIBADD = $(LIB_KOFFICEUI)
+kde_kcfg_DATA = koshell.kcfg
 
 METASOURCES = AUTO
 
Index: koshell_shell.cc
===================================================================
RCS file: /home/kde/koffice/koshell/koshell_shell.cc,v
retrieving revision 1.76
diff -u -3 -p -r1.76 koshell_shell.cc
--- koshell_shell.cc	14 Aug 2004 16:42:53 -0000	1.76
+++ koshell_shell.cc	18 Feb 2005 20:42:02 -0000
@@ -19,10 +19,11 @@
    Boston, MA 02111-1307, USA.
 */
 
-#include <qhbox.h>
+#include <qsplitter.h>
 #include <assert.h>
 
 #include "koshell_shell.h"
+#include "koshellsettings.h"
 
 #include <ktempfile.h>
 #include <kfiledialog.h>
@@ -52,13 +53,12 @@ KoShellWindow::KoShellWindow()
 {
   m_activePage = m_lstPages.end();
 
-  m_pLayout = new QHBox( centralWidget() );
-
+  m_pLayout = new QSplitter( centralWidget() );
   m_pKoolBar = new KoKoolBar( m_pLayout );
 
   m_pFrame = new KoShellFrame( m_pLayout );
 
-  m_grpFile = m_pKoolBar->insertGroup(i18n("Parts"));
+  m_grpFile = m_pKoolBar->insertGroup(i18n("Components"));
   QValueList<KoDocumentEntry> lstComponents = \
KoDocumentEntry::query(false,QString());  QValueList<KoDocumentEntry>::Iterator it = \
lstComponents.begin();  for( ; it != lstComponents.end(); ++it )
@@ -93,9 +93,11 @@ KoShellWindow::KoShellWindow()
   m_grpDocuments = m_pKoolBar->insertGroup(i18n("Documents"));
   //m_pKoolBar->insertGroup("Snippets"); //?
 
-  m_pKoolBar->setFixedWidth( 80 );
-  m_pKoolBar->setMinimumHeight( 300 );
+  // Read the config file
+  readConfig();
 
+  m_pKoolBar->resize( m_width, m_pKoolBar->height() );
+  
   connect( this, SIGNAL( documentSaved() ),
            this, SLOT( slotNewDocumentName() ) );
 
@@ -128,6 +130,7 @@ KoShellWindow::~KoShellWindow()
   m_lstPages.clear();
 
   setRootDocumentDirect( 0L, QPtrList<KoView>() ); // prevent our parent destructor \
from doing stupid things +  saveSettings(); // Now save our settings before exiting
 }
 
 bool KoShellWindow::openDocumentInternal( const KURL &url, KoDocument* )
@@ -558,6 +561,15 @@ bool KoShellWindow::saveAllPages()
   return false;
 }
 */
+void KoShellWindow::readConfig()
+{ 
+	m_width = KoShellSettings::sidebarWidth();
+} 
+
+void KoShellWindow::saveSettings()
+{
+  KoShellSettings::setSidebarWidth( m_pKoolBar->width() );	
+}
 
 QString KoShellWindow::configFile() const
 {
Index: koshell_shell.h
===================================================================
RCS file: /home/kde/koffice/koshell/koshell_shell.h,v
retrieving revision 1.29
diff -u -3 -p -r1.29 koshell_shell.h
--- koshell_shell.h	5 Dec 2003 16:33:08 -0000	1.29
+++ koshell_shell.h	18 Feb 2005 20:42:02 -0000
@@ -27,7 +27,7 @@
 #include <qmap.h>
 #include <qvaluelist.h>
 
-class QHBox;
+class QSplitter;
 class KoKoolBar;
 class KoDocumentEntry;
 class KoShellFrame;
@@ -71,7 +71,9 @@ protected:
 
   virtual bool openDocumentInternal( const KURL & url, KoDocument * newdoc = 0L );
   void closeDocument();
-
+  void readConfig();
+  void saveSettings();
+  
   struct Page
   {
     KoDocument *m_pDoc;
@@ -88,7 +90,8 @@ protected:
 
   int m_grpFile;
   int m_grpDocuments;
-
+  int m_width;
+  
   // Map of available parts (the int is the koolbar item id)
   QMap<int,KoDocumentEntry> m_mapComponents;
 
@@ -102,7 +105,7 @@ protected:
   KoShellGUIClient *m_client;
   void createShellGUI();
 
-  QHBox *m_pLayout;
+  QSplitter *m_pLayout;
 };
 
 ///////// class KoShellFrame ////////////



_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


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

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