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

List:       kde-commits
Subject:    koffice/kword
From:       Thomas Zander <zander () kde ! org>
Date:       2007-06-25 13:50:05
Message-ID: 1182779405.004399.32332.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 680129 by zander:

re-add the statistics dialog.


 M  +4 -1      part/CMakeLists.txt  
 M  +1 -0      part/KWCanvas.cpp  
 M  +3 -1      part/KWDocument.cpp  
 M  +20 -4     part/KWView.cpp  
 M  +1 -0      part/KWView.h  
 M  +6 -2      part/KWord.h  
 A             part/dialogs/KWStatistics.cpp   [License: LGPL (v2+)]
 A             part/dialogs/KWStatistics.h   [License: LGPL (v2+)]
 A             part/dialogs/KWStatistics.ui  
 A             part/dialogs/KWStatisticsDialog.cpp   [License: LGPL (v2+)]
 A             part/dialogs/KWStatisticsDialog.h   [License: LGPL (v2+)]
 M  +3 -1      plugins/scripting/Tool.h  


--- trunk/koffice/kword/part/CMakeLists.txt #680128:680129
@@ -3,7 +3,7 @@
 add_subdirectory( frames/tests )
 add_subdirectory( tests )
 
-include_directories( ${KOTEXT_INCLUDES} ${KOGUIUTILS_INCLUDES} )
+include_directories( ${KOTEXT_INCLUDES} ${KOGUIUTILS_INCLUDES} \
${KDE4_INCLUDE_DIR}/threadweaver/ )  
 ########### KWordPrivate library ###############
 
@@ -43,6 +43,8 @@
     dialogs/KWPageLayout.cpp
     dialogs/KWStartupWidget.cpp
     dialogs/KWPageSettingsDialog.cpp
+    dialogs/KWStatistics.cpp
+    dialogs/KWStatisticsDialog.cpp
 
     commands/KWPagePropertiesCommand.cpp
     commands/KWPageInsertCommand.cpp
@@ -57,6 +59,7 @@
     dialogs/KWDocumentColumns.ui
     dialogs/KWPageLayout.ui
     dialogs/KWStartupWidget.ui
+    dialogs/KWStatistics.ui
 )
 
 kde4_automoc(${kwordprivate_LIB_SRCS})
--- trunk/koffice/kword/part/KWCanvas.cpp #680128:680129
@@ -71,6 +71,7 @@
 }
 
 void KWCanvas::updateSize() {
+    resourceProvider()->setResource(KWord::CurrentPageCount, \
m_document->pageCount());  emit documentSize(m_viewMode->contentsSize());
 }
 
--- trunk/koffice/kword/part/KWDocument.cpp #680128:680129
@@ -239,7 +239,7 @@
             KoToolManager::instance()->switchToolRequested(
                     \
KoToolManager::instance()->preferredToolForSelection(selection->selectedShapes()));  \
                }
-   }
+    }
 
     return view;
 }
@@ -296,6 +296,7 @@
         foreach(KoView *view, views()) {
             KWCanvas *canvas = static_cast<KWView*>(view)->kwcanvas();
             canvas->shapeManager()->remove(frame->shape());
+            canvas->resourceProvider()->setResource(KWord::CurrentFrameSetCount, \
m_frameSets.count());  }
     }
     emit frameSetRemoved(fs);
@@ -342,6 +343,7 @@
     foreach(KoView *view, views()) {
         KWCanvas *canvas = static_cast<KWView*>(view)->kwcanvas();
         canvas->shapeManager()->add(frame->shape());
+        canvas->resourceProvider()->setResource(KWord::CurrentFrameSetCount, \
m_frameSets.count());  }
     frame->shape()->repaint();
 }
--- trunk/koffice/kword/part/KWView.cpp #680128:680129
@@ -30,6 +30,7 @@
 #include "frames/KWTextFrameSet.h"
 #include "dialogs/KWFrameDialog.h"
 #include "dialogs/KWPageSettingsDialog.h"
+#include "dialogs/KWStatisticsDialog.h"
 
 // koffice libs includes
 #include <KoCopyController.h>
@@ -213,6 +214,12 @@
     action = actionCollection()->addAction(KStandardAction::Paste,  "edit_paste", 0, \
0);  new KoPasteController(kwcanvas(), action);
 
+    action  = new KAction(i18n("Statistics"), this);
+    actionCollection()->addAction("file_statistics", action );
+    action->setToolTip( i18n( "Sentence, word and letter counts for this document" ) \
); +    action->setWhatsThis( i18n( "Information on the number of letters, words, \
syllables and sentences for this document.<p>Evaluates readability using the Flesch \
reading score." ) ); +    connect(action, SIGNAL(triggered()), this, SLOT( \
showStatisticsDialog() )); +
 /* ********** From old kwview ****
 We probably want to have each of these again, so just move them when you want to \
implement it  This saves problems with finding out which we missed near the end.
@@ -224,10 +231,6 @@
     m_actionExtraCreateTemplate->setToolTip( i18n( "Save this document and use it \
later as a template" ) );  m_actionExtraCreateTemplate->setWhatsThis( i18n( "You can \
save this document as a template.<br><br>You can use this new template as a starting \
point for another document." ) );  
-    m_actionFileStatistics  = new KAction(i18n("Statistics"), this);
-    actionCollection()->addAction("file_statistics", m_actionFileStatistics );
-    m_actionFileStatistics->setToolTip( i18n( "Sentence, word and letter counts for \
                this document" ) );
-    m_actionFileStatistics->setWhatsThis( i18n( "Information on the number of \
letters, words, syllables and sentences for this document.<p>Evaluates readability \
using the Flesch reading score." ) );  // -------------- Edit actions
     m_actionEditCut = actionCollection()->addAction(KStandardAction::Cut,  \
                "edit_cut", this, SLOT( editCut() ));
     m_actionEditCopy = actionCollection()->addAction(KStandardAction::Copy,  \
"edit_copy", this, SLOT( editCopy() )); @@ -1045,6 +1048,12 @@
     handler->insertInlineObject(anchor);
 }
 
+void KWView::showStatisticsDialog() {
+    KWStatisticsDialog *dia = new KWStatisticsDialog(this);
+    dia->exec();
+    delete dia;
+}
+
 // end of actions
 
 void KWView::popupContextMenu(QPoint globalPosition, const QList<QAction*> &actions) \
{ @@ -1066,12 +1075,19 @@
     m_actionFormatFrameSet->setEnabled( shape != 0 );
     if(shape) {
         m_currentPage = m_document->pageManager()->page(shape);
+        m_canvas->resourceProvider()->setResource(KWord::CurrentPage, \
m_currentPage->pageNumber());  \
m_zoomController->setPageSize(m_currentPage->rect().size());  }
     m_actionEditDelFrame->setEnabled(false);
+    bool first = true;
     foreach(KoShape *shape, \
kwcanvas()->shapeManager()->selection()->selectedShapes(KoFlake::TopLevelSelection)) \
                {
         KWFrame *frame = dynamic_cast<KWFrame*>(shape->applicationData());
         Q_ASSERT(frame);
+        if(first) {
+            m_canvas->resourceProvider()->setResource(KWord::CurrentFrame, frame);
+            m_canvas->resourceProvider()->setResource(KWord::CurrentFrameSet, \
frame->frameSet()); +            first = false;
+        }
         KWTextFrameSet *fs = dynamic_cast<KWTextFrameSet*>(frame->frameSet());
         if(fs == 0 || fs->textFrameSetType() == KWord::OtherTextFrameSet) {
             m_actionEditDelFrame->setEnabled(true);
--- trunk/koffice/kword/part/KWView.h #680128:680129
@@ -111,6 +111,7 @@
     void formatPage();
     void inlineFrame();
     void zoomChanged (KoZoomMode::Mode mode, double zoom);
+    void showStatisticsDialog();
 
 private:
     /// helper method for the raiseFrame/lowerFrame/bringToFront/sendToBack methods
--- trunk/koffice/kword/part/KWord.h #680128:680129
@@ -111,9 +111,13 @@
     /// Specifies the KWord specific resources that you can put and get from the \
KoCanvasResourceProvider  enum KWordCanvasResources {
         // lets try to put Current in front of everything for ease of reading.
-        CurrentTextCursor = KoCanvasResource::KWordStart + 1, ///< The text cursor \
with position and selection  CurrentFrame,
-        CurrentFrameSet
+        CurrentFrameSet,
+        CurrentPage,
+        CurrentFrameSetCount,
+        CurrentPictureCount,
+        CurrentTableCount,
+        CurrentPageCount
     };
 };
 
--- trunk/koffice/kword/plugins/scripting/Tool.h #680128:680129
@@ -108,7 +108,9 @@
                 if( ! r ) return false;
                 QVariant variant;
                 variant.setValue( (QObject*) &textcursor->cursor() );
-                r->setResource(KWord::CurrentTextCursor, variant);
+// the above can't work;  storing a pointer to a value based object (QTextCursor).
+// I don't even think its possible to store a QTextCursor in any form in a QVarient. \
(TZ) +                //r->setResource(KWord::CurrentTextCursor, variant);
                 return true;
             }
 


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

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