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

List:       kde-commits
Subject:    koffice/kword/part
From:       Jon de Andres Frias <jondeandres () gmail ! com>
Date:       2009-09-19 17:57:21
Message-ID: 1253383041.362018.25890.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1025796 by jdandres:

KWStatusBar saves its config using KWApplicationConfig. The status bar config is \
saved in [Interface] config group.


 M  +10 -1     KWApplicationConfig.cpp  
 M  +34 -0     KWApplicationConfig.h  
 M  +40 -13    KWStatusBar.cpp  
 M  +4 -0      KWStatusBar.h  


--- trunk/koffice/kword/part/KWApplicationConfig.cpp #1025795:1025796
@@ -66,9 +66,14 @@
     m_zoom = interface.readEntry("Zoom", m_zoom);
     m_zoomMode = static_cast<KoZoomMode::Mode>(interface.readEntry("ZoomMode", (int) \
m_zoomMode));  
+    m_statusBarShowPage = interface.readEntry("StatusBarShowPage", \
m_statusBarShowPage); +    m_statusBarShowModified = \
interface.readEntry("StatusBarShowModified", m_statusBarShowModified); +    \
m_statusBarShowMouse = interface.readEntry("StatusBarShowMouse", \
m_statusBarShowMouse); +    m_statusBarShowZoom = \
interface.readEntry("StatusBarShowZoom", m_statusBarShowZoom); +
 //    m_bShowDocStruct = interface.readEntry( "showDocStruct", true );
 //    m_viewModeType = interface.readEntry( "viewmode", "ModeNormal" );
-//    setShowStatusBar( interface.readEntry( "ShowStatusBar" , true ) );
+//    setShowStatusBarShow( interface.readEntry( "ShowStatusBarShow" , true ) );
 //    setAllowAutoFormat( interface.readEntry( "AllowAutoFormat" , true ) );
 //    setShowScrollBar( interface.readEntry( "ShowScrollBar", true ) );
 //    if ( isEmbedded() )
@@ -133,5 +138,9 @@
 //    interface.writeEntry( "AllowAutoFormat", m_bAllowAutoFormat );
 //    interface.writeEntry( "ShowGrid" , m_bShowGrid );
 //    interface.writeEntry( "SnapToGrid" , m_bSnapToGrid );
+    interface.writeEntry("StatusBarShowPage", m_statusBarShowPage);
+    interface.writeEntry("StatusBarShowModified", m_statusBarShowModified);
+    interface.writeEntry("StatusBarShowMouse", m_statusBarShowMouse);
+    interface.writeEntry("StatusBarShowZoom", m_statusBarShowZoom);
     interface.sync();
 }
--- trunk/koffice/kword/part/KWApplicationConfig.h #1025795:1025796
@@ -51,6 +51,38 @@
         return m_viewRulers;
     }
 
+    void setStatusBarShowPage(bool on) {
+        m_statusBarShowPage = on;
+    }
+
+    bool statusBarShowPage() {
+        return m_statusBarShowPage;
+    }
+
+    void setStatusBarShowModified(bool on) {
+        m_statusBarShowModified = on;
+    }
+
+    bool statusBarShowModified() {
+        return m_statusBarShowModified;
+    }
+
+    void setStatusBarShowMouse(bool on) {
+        m_statusBarShowMouse = on;
+    }
+
+    bool statusBarShowMouse() {
+        return m_statusBarShowMouse;
+    }
+
+    void setStatusBarShowZoom(bool on) {
+        m_statusBarShowZoom = on;
+    }
+
+    bool statusBarShowZoom() {
+        return m_statusBarShowZoom;
+    }
+
     /**
      * Set the zoom level for new views and for next startups of kword.
      * Documents shown at 100% will show the page on screen at the same amount of
@@ -94,6 +126,8 @@
     bool m_viewFrameBorders, m_viewRulers, m_viewFormattingChars, \
m_viewFormattingBreak, m_viewFormattingSpace;  bool m_viewFormattingEndParag, \
m_viewFormattingTabs;  bool m_createBackupFile;
+    bool m_statusBarShowPage, m_statusBarShowModified;
+    bool m_statusBarShowMouse, m_statusBarShowZoom;
 
     int m_zoom; /// < zoom level in percent
     KoZoomMode::Mode m_zoomMode;
--- trunk/koffice/kword/part/KWStatusBar.cpp #1025795:1025796
@@ -56,14 +56,15 @@
     const QString s = i18nPage.subs("999").subs("999").toString();
     m_pageLabel->setMinimumWidth(QFontMetrics(m_pageLabel->font()).width(s));
     m_statusbar->addWidget(m_pageLabel);
+    m_pageLabel->setVisible(m_document->config().statusBarShowPage());
     connect(m_document, SIGNAL(pageSetupChanged()), this, SLOT(updatePageCount()));
 
     KAction *action = new KAction(i18n("Page: current/total"), this);
     action->setObjectName("pages_current_total");
     action->setCheckable(true);
-    action->setChecked(true);
+    action->setChecked(m_document->config().statusBarShowPage());
     m_statusbar->addAction(action);
-    connect(action, SIGNAL(toggled(bool)), m_pageLabel, SLOT(setVisible(bool)));
+    connect(action, SIGNAL(toggled(bool)), this, SLOT(showPage(bool)));
 
     m_modifiedLabel = new QLabel(m_statusbar);
     m_modifiedLabel->setFrameShape(QFrame::Panel);
@@ -72,28 +73,29 @@
     m_modifiedLabel->setMinimumWidth(qMax(fm.width(i18nModified), \
fm.width(i18nSaved)));  m_statusbar->addWidget(m_modifiedLabel);
     setModified(m_document->isModified());
+    m_modifiedLabel->setVisible(m_document->config().statusBarShowModified());
     connect(m_document, SIGNAL(modified(bool)), this, SLOT(setModified(bool)));
 
     action = new KAction(i18n("State: saved/modified"), this);
     action->setObjectName("doc_save_state");
     action->setCheckable(true);
-    action->setChecked(true);
+    action->setChecked(m_document->config().statusBarShowModified());
     m_statusbar->addAction(action);
-    connect(action, SIGNAL(toggled(bool)), m_modifiedLabel, SLOT(setVisible(bool)));
+    connect(action, SIGNAL(toggled(bool)), this, SLOT(showModified(bool)));
 
     m_mousePosLabel = new QLabel(m_statusbar);
     m_mousePosLabel->setFrameShape(QFrame::Panel);
     m_mousePosLabel->setFrameShadow(QFrame::Sunken);
     m_mousePosLabel->setMinimumWidth(QFontMetrics(m_mousePosLabel->font()).width("9999:9999"));
                
-    m_mousePosLabel->setVisible(false);
     m_statusbar->addWidget(m_mousePosLabel);
+    m_mousePosLabel->setVisible(m_document->config().statusBarShowMouse());
 
     action = new KAction(i18n("Mouseposition: X:Y"), this);
     action->setObjectName("mousecursor_pos");
     action->setCheckable(true);
-    action->setChecked(false);
+    action->setChecked(m_document->config().statusBarShowMouse());
     m_statusbar->addAction(action);
-    connect(action, SIGNAL(toggled(bool)), m_mousePosLabel, SLOT(setVisible(bool)));
+    connect(action, SIGNAL(toggled(bool)), this, SLOT(showMouse(bool)));
 
     m_statusLabel = new KSqueezedTextLabel(m_statusbar);
     m_statusbar->addWidget(m_statusLabel, 1);
@@ -102,7 +104,7 @@
     m_zoomAction = new KAction(i18n("Zoom Controller"), this);
     m_zoomAction->setObjectName("zoom_controller");
     m_zoomAction->setCheckable(true);
-    m_zoomAction->setChecked(true);
+    m_zoomAction->setChecked(m_document->config().statusBarShowZoom());
     m_statusbar->addAction(m_zoomAction);
 
     updateCurrentTool(0);
@@ -188,7 +190,7 @@
         QWidget *zoomWidget = m_zoomWidgets.value(m_currentView);
         if (zoomWidget) {
             m_statusbar->removeWidget(zoomWidget);
-            disconnect(m_zoomAction, SIGNAL(toggled(bool)), zoomWidget, \
SLOT(setVisible(bool))); +            disconnect(m_zoomAction, SIGNAL(toggled(bool)), \
this, SLOT(showZoom(bool)));  }
     }
 
@@ -198,8 +200,8 @@
     QWidget *zoomWidget = m_zoomWidgets.value(m_currentView);
     if (zoomWidget) {
         m_statusbar->addWidget(zoomWidget);
-        connect(m_zoomAction, SIGNAL(toggled(bool)), zoomWidget, \
                SLOT(setVisible(bool)));
-        zoomWidget->setVisible(m_zoomAction->isChecked());
+        connect(m_zoomAction, SIGNAL(toggled(bool)), this, SLOT(showZoom(bool)));
+        zoomWidget->setVisible(m_document->config().statusBarShowZoom());
     } else {
         // do it delayed to avoid a race condition where this code
         // is ran from the constructor of KWView before the zoomController is \
created. @@ -221,12 +223,37 @@
             QWidget *zoomWidget = \
zoomController->zoomAction()->createWidget(m_statusbar);  \
m_zoomWidgets.insert(m_currentView, zoomWidget);  m_statusbar->addWidget(zoomWidget);
-            connect(m_zoomAction, SIGNAL(toggled(bool)), zoomWidget, \
                SLOT(setVisible(bool)));
-            zoomWidget->setVisible(m_zoomAction->isChecked());
+            connect(m_zoomAction, SIGNAL(toggled(bool)), this, \
SLOT(showZoom(bool))); +            \
zoomWidget->setVisible(m_document->config().statusBarShowZoom());  }
     }
 }
 
+void KWStatusBar::showPage(bool visible )
+{
+    m_document->config().setStatusBarShowPage(visible);
+    m_pageLabel->setVisible(visible);
+}
+
+void KWStatusBar::showModified(bool visible )
+{
+    m_document->config().setStatusBarShowModified(visible);
+    m_modifiedLabel->setVisible(visible);
+}
+
+void KWStatusBar::showMouse(bool visible)
+{
+    m_document->config().setStatusBarShowMouse(visible);
+    m_mousePosLabel->setVisible(visible);
+}
+
+void KWStatusBar::showZoom(bool visible )
+{
+    QWidget *zoomWidget = m_zoomWidgets.value(m_currentView);
+    m_document->config().setStatusBarShowZoom(visible);
+    zoomWidget->setVisible(visible);
+}
+
 void KWStatusBar::updateMousePosition(const QPoint &pos)
 {
     //kDebug(32003)<<"KWStatusBar::updateMousePosition";
--- trunk/koffice/kword/part/KWStatusBar.h #1025795:1025796
@@ -61,6 +61,10 @@
     void resourceChanged(int, const QVariant&);
     void updateCurrentTool(KoCanvasController*);
     void createZoomWidget();
+    void showPage(bool visible);
+    void showModified(bool visible);
+    void showMouse(bool visible);
+    void showZoom(bool visible);
 
 private:
     /**


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

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