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

List:       kde-commits
Subject:    KDE/kdeedu/kvoctrain/kvoctrain
From:       Peter Hedlund <peter () peterandlinda ! com>
Date:       2007-03-12 22:58:36
Message-ID: 1173740316.684581.32553.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 641958 by hedlund:

Moved the search bar to its new location. Needs an entry in Prefs.

 M  +34 -14    kva_init.cpp  
 M  +6 -0      kvoctrain.cpp  
 M  +4 -0      kvoctrain.h  
 M  +3 -3      kvoctrainui.rc  


--- trunk/KDE/kdeedu/kvoctrain/kvoctrain/kva_init.cpp #641957:641958
@@ -41,6 +41,7 @@
 #include <kselectaction.h>
 #include <kstatusbar.h>
 #include <kstandardaction.h>
+#include <ktoggleaction.h>
 #include <kmenu.h>
 #include <kiconloader.h>
 #include <kstandarddirs.h>
@@ -275,25 +276,18 @@
   connect(m_lessonsComboBox, SIGNAL(highlighted(int)), this, \
SLOT(slotChooseLesson(int)));  m_lessonsComboBox->setFocusPolicy(Qt::NoFocus);
 
+/*
   vocabLessons = actionCollection()->addAction("vocab_lessons");
   vocabLessons->setText(i18n("Lessons"));
   qobject_cast<KAction*>(vocabLessons)->setDefaultWidget(m_lessonsComboBox);
   vocabLessons->setWhatsThis(i18n("Choose current lesson"));
   vocabLessons->setToolTip(vocabLessons->whatsThis());
   vocabLessons->setStatusTip(vocabLessons->whatsThis());
-
-
-  /// @todo Replace this by a search line above the table. More kde standard. But \
                since it works I'll leave it here for now.
-  searchLine = new KLineEdit(this);
-  searchLine->setFocusPolicy(Qt::ClickFocus);
-  //connect(searchLine, SIGNAL(returnPressed()), this, SLOT(slotSearchNext()));
-  connect(searchLine, SIGNAL(textChanged(const QString&)), this, \
                SLOT(slotSearch(const QString&)));
-
-
-  vocabSearch = actionCollection()->addAction("vocab_search");
-  vocabSearch->setText(i18n("Smart Search"));
-  qobject_cast<KAction*>(vocabSearch)->setDefaultWidget(searchLine);
-  vocabSearch->setWhatsThis(i18n("Search vocabulary for specified text "));
+*/
+  vocabSearch = actionCollection()->add<KToggleAction>("config_show_search");
+  vocabSearch->setText(i18n("Show Se&arch"));
+  connect(vocabSearch, SIGNAL(triggered(bool)), this, SLOT(slotConfigShowSearch()));
+  vocabSearch->setWhatsThis(i18n("Toggle display of the search bar"));
   vocabSearch->setToolTip(vocabSearch->whatsThis());
   vocabSearch->setStatusTip(vocabSearch->whatsThis());
 
@@ -452,10 +446,36 @@
   topLayout->addWidget(m_mainSplitter);
   /// List of lessons
   m_mainSplitter->addWidget(initLessonList(centralWidget()));
+
+  searchLine = new KLineEdit(this);
+  searchLine->show();
+  searchLine->setFocusPolicy(Qt::ClickFocus);
+  searchLine->setClearButtonShown(true);
+  connect(searchLine, SIGNAL(textChanged(const QString&)), this, \
SLOT(slotSearch(const QString&))); +
+  QLabel *label = new QLabel( i18n("S&earch:"), this );
+  label->setBuddy(searchLine);
+  label->show();
+
+  m_searchWidget = new QWidget(this);
+  QHBoxLayout* layout = new QHBoxLayout(m_searchWidget);
+  layout->setSpacing(KDialog::spacingHint());
+  layout->setMargin(0);
+  layout->addWidget(label);
+  layout->addWidget(searchLine);
+
+  QWidget * rightWidget = new QWidget(this);
+  QVBoxLayout * rightLayout = new QVBoxLayout(rightWidget);
+  rightLayout->setSpacing(KDialog::spacingHint());
+  rightLayout->setMargin(0);
+  rightLayout->addWidget(m_searchWidget);
+
   /// Table view
   m_tableView = new KVTTableView(centralWidget());
   m_tableView->setFrameStyle(QFrame::NoFrame);
-  m_mainSplitter->addWidget(m_tableView);
+  rightLayout->addWidget(m_tableView, 1, 0);
+
+  m_mainSplitter->addWidget(rightWidget);
   /// Filter proxy
 
   m_tableView->setModel(m_sortFilterModel);
--- trunk/KDE/kdeedu/kvoctrain/kvoctrain/kvoctrain.cpp #641957:641958
@@ -1384,4 +1384,10 @@
   slotStatusMsg(IDS_DEFAULT);
 }
 
+void KVocTrainApp::slotConfigShowSearch()
+{
+  if (m_searchWidget)
+    m_searchWidget->setVisible(m_searchWidget->isHidden());
+}
+
 #include "kvoctrain.moc"
--- trunk/KDE/kdeedu/kvoctrain/kvoctrain/kvoctrain.h #641957:641958
@@ -233,6 +233,8 @@
   /** change the status message of the whole statusbar temporary */
   void slotStatusHelpMsg(const QString &text);
 
+  void slotConfigShowSearch();
+
 public:
   void removeProgressBar();
   void prepareProgressBar();
@@ -306,6 +308,8 @@
 
   QSplitter *m_mainSplitter;
 
+  QWidget *m_searchWidget;
+
   /** m_doc represents your vocabulary document. It keeps
     * information such as filename and does the serialization of your files.
     */
--- trunk/KDE/kdeedu/kvoctrain/kvoctrain/kvoctrainui.rc #641957:641958
@@ -36,9 +36,9 @@
    <Action name="learning_resume_query" />
    <Action name="learning_resume_multiple_choice" /> -->
   </Menu>
-<!--  <Menu name="settings" >
-   <Action append="configure_merge" name="config_query_options" />
-  </Menu>-->
+  <Menu name="settings" >
+    <Action name="config_show_search" />
+  </Menu>
  </MenuBar>
  <ToolBar noMerge="1" name="mainToolBar" >
   <text>Main Toolbar</text>


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

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