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

List:       kde-commits
Subject:    branches/work/kde4/playground/graphics/okular
From:       Pino Toscano <toscano.pino () tiscali ! it>
Date:       2006-03-31 23:08:23
Message-ID: 1143846503.027980.2497.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 525154 by pino:

Reactivate the SearchWidget (still not working yet).
Make use of some new Qt4 functions for QActions.


 M  +4 -8      part.cpp  
 M  +20 -27    ui/searchwidget.cpp  
 M  +3 -3      ui/searchwidget.h  


--- branches/work/kde4/playground/graphics/okular/part.cpp #525153:525154
@@ -153,14 +153,12 @@
 	// [left toolbox: Thumbnails and Bookmarks] | []
 	KVBox * thumbsBox = new ThumbnailsBox( m_toolBox );
 	thumbsBox->setSpacing( 4 );
-#warning this is making it crash
-//	m_searchWidget = new SearchWidget( thumbsBox, m_document );
+	m_searchWidget = new SearchWidget( thumbsBox, m_document );
 	m_thumbnailList = new ThumbnailList( thumbsBox, m_document );
 //	ThumbnailController * m_tc = new ThumbnailController( thumbsBox, m_thumbnailList \
);  connect( m_thumbnailList, SIGNAL( urlDropped( const KUrl& ) ), SLOT( \
openURLFromDocument( const KUrl & )) );  connect( m_thumbnailList, SIGNAL( \
rightClick(const KPDFPage *, const QPoint &) ), this, SLOT( slotShowMenu(const \
KPDFPage *, const QPoint &) ) );  // shrink the bottom controller toolbar (too \
                hackish..)
-	thumbsBox->setStretchFactor( m_searchWidget, 100 );
 	thumbsBox->setStretchFactor( m_thumbnailList, 100 );
 //	thumbsBox->setStretchFactor( m_tc, 1 );
 	tbIndex = m_toolBox->addItem( thumbsBox, SmallIconSet("thumbnail"), \
i18n("Thumbnails") ); @@ -581,8 +579,7 @@
     if (!m_file.isEmpty()) m_watcher->removeFile(m_file);
     m_document->closeDocument();
     updateViewActions();
-#warning this is commented because m_searchWidget is commented
-    //m_searchWidget->clearText();
+    m_searchWidget->clearText();
     return KParts::ReadOnlyPart::closeURL();
 }
 
@@ -857,9 +854,8 @@
     }
 
     bool showSearch = KpdfSettings::showSearchBar();
-#warning this is commented because m_searchWidget is commented
-/*    if ( m_searchWidget->isShown() != showSearch )
-        m_searchWidget->setShown( showSearch );*/
+    if ( m_searchWidget->isShown() != showSearch )
+        m_searchWidget->setShown( showSearch );
 
     // Main View (pageView)
     Q3ScrollView::ScrollBarMode scrollBarMode = KpdfSettings::showScrollBars() ?
--- branches/work/kde4/playground/graphics/okular/ui/searchwidget.cpp #525153:525154
@@ -25,11 +25,12 @@
 #include "settings.h"
 
 SearchWidget::SearchWidget( QWidget * parent, KPDFDocument * document )
-    : KToolBar( parent, "iSearchBar" ), m_document( document ),
+    : QToolBar( parent ), m_document( document ),
     m_searchType( 0 ), m_caseSensitive( false )
 {
+    setObjectName( "iSearchBar" );
     // change toolbar appearance
-    setIconDimensions( 16 );
+    setIconSize(QSize(16, 16));
     setMovable( false );
 
     // a timer to ensure that we don't flood the document with requests to search
@@ -37,18 +38,19 @@
     connect( m_inputDelayTimer, SIGNAL( timeout() ),
              this, SLOT( startSearch() ) );
 
-    // 1. text line
+    // 1. clear button
+    QAction *clearAction = addAction( KIcon(layoutDirection() ==
+ Qt::RightToLeft ? "clear_left" : "locationbar_erase"),
+                  QString::null);
+    clearAction->setToolTip(i18n( "Clear filter" ));
+
+    // 2. text line
     m_lineEdit = new KLineEdit(this);
     m_lineEdit->setToolTip(i18n( "Enter at least 3 letters to filter pages" ));
     connect(m_lineEdit, SIGNAL( textChanged(const QString &) ), this, SLOT( \
slotTextChanged(const QString &) )); +    connect(clearAction, SIGNAL( triggered() ), \
m_lineEdit, SLOT( clear() ));  addWidget(m_lineEdit);
 
-    // 2. clear button (uses a lineEdit slot, so it must be created after)
-    QAction *clearAction = addAction( KIcon(layoutDirection() ==
- Qt::RightToLeft ? "clear_left" : "locationbar_erase"),
-                  QString::null, m_lineEdit, SLOT( clear() ));
-    clearAction->setToolTip(i18n( "Clear filter" ));
-
     // 3.1. create the popup menu for changing filtering features
     m_menu = new QMenu( this );
     m_caseSensitiveAction = m_menu->addAction( i18n("Case Sensitive") );
@@ -58,20 +60,21 @@
     m_marchAnyWordsAction = m_menu->addAction( i18n("Match Any Word") );
 
     m_caseSensitiveAction->setCheckable( true );
+    QActionGroup *actgrp = new QActionGroup( this );
     m_matchPhraseAction->setCheckable( true );
+    m_matchPhraseAction->setActionGroup( actgrp );
     m_marchAllWordsAction->setCheckable( true );
+    m_marchAllWordsAction->setActionGroup( actgrp );
     m_marchAnyWordsAction->setCheckable( true );
+    m_marchAnyWordsAction->setActionGroup( actgrp );
 
     m_marchAllWordsAction->setChecked( true );
     connect( m_menu, SIGNAL( triggered(QAction *) ), SLOT( slotMenuChaged(QAction*) \
) );  
     // 3.2. create the toolbar button that spawns the popup menu
-#warning still have to connect that to the menu
-    //insertButton( "kpdf", FIND_ID, m_menu, true, i18n( "Filter Options" ), \
                2/*index*/ );
-
-    // always maximize the text line
-#warning port setItemAutoSized
-    //setItemAutoSized( LEDIT_ID );
+    QAction *optionsMenuAction = addAction( KIcon( "oKular" ), QString::null);
+    optionsMenuAction->setToolTip( i18n("Filter Options") );
+    optionsMenuAction->setMenu( m_menu );
 }
 
 void SearchWidget::clearText()
@@ -101,23 +104,14 @@
     else if ( act == m_matchPhraseAction )
     {
         m_searchType = 0;
-        m_matchPhraseAction->setChecked( true );
-        m_marchAllWordsAction->setChecked( false );
-        m_marchAnyWordsAction->setChecked( false );
     }
     else if ( act == m_marchAllWordsAction )
     {
         m_searchType = 1;
-        m_matchPhraseAction->setChecked( false );
-        m_marchAllWordsAction->setChecked( true );
-        m_marchAnyWordsAction->setChecked( false );
     }
     else if ( act == m_marchAnyWordsAction )
     {
         m_searchType = 2;
-        m_matchPhraseAction->setChecked( false );
-        m_marchAllWordsAction->setChecked( false );
-        m_marchAnyWordsAction->setChecked( true );
     }
     else
         return;
@@ -144,9 +138,8 @@
     // if not found, use warning colors
     if ( !ok )
     {
-        KLineEdit * lineEdit = m_lineEdit;
-        lineEdit->setPaletteForegroundColor( Qt::white );
-        lineEdit->setPaletteBackgroundColor( Qt::red );
+        m_lineEdit->setPaletteForegroundColor( Qt::white );
+        m_lineEdit->setPaletteBackgroundColor( Qt::red );
     }
 }
 
--- branches/work/kde4/playground/graphics/okular/ui/searchwidget.h #525153:525154
@@ -10,12 +10,12 @@
 #ifndef _KPDF_SEARCHWIDGET_H_
 #define _KPDF_SEARCHWIDGET_H_
 
-#include <ktoolbar.h>
+#include <qtoolbar.h>
 
 class KPDFDocument;
 class KLineEdit;
-class m_inputDelayTimer;
 class QAction;
+class QTimer;
 
 // definition of searchID for this class (publicly available to ThumbnailsList)
 #define SW_SEARCH_ID 3
@@ -28,7 +28,7 @@
  * It supports case sensitive/unsensitive(default) and provieds a button
  * for switching between the 2 modes.
  */
-class SearchWidget : public KToolBar
+class SearchWidget : public QToolBar
 {
     Q_OBJECT
     public:


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

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