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

List:       kde-commits
Subject:    KDE/kdebase/runtime/kurifilter-plugins/ikws
From:       Frederik Gladhorn <gladhorn () kde ! org>
Date:       2008-10-12 13:41:14
Message-ID: 1223818874.104958.4096.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 870406 by gladhorn:

improve handling of invalid user input for web shortcuts (no \{..})


 M  +1 -2      ikwsopts.cpp  
 M  +21 -16    searchproviderdlg.cpp  
 M  +1 -1      searchproviderdlg.h  


--- trunk/KDE/kdebase/runtime/kurifilter-plugins/ikws/ikwsopts.cpp #870405:870406
@@ -343,8 +343,7 @@
 {
   SearchProviderDialog dlg(0, this);
 
-  // Provider can be 0 if the user chooses accept but has not entered \{...} in the \
                query and chooses cancel then.
-  if (dlg.exec() && dlg.provider())
+  if (dlg.exec())
   {
       m_dlg->lvSearchProviders->setCurrentItem(displaySearchProvider(dlg.provider()));
  configChanged();
--- trunk/KDE/kdebase/runtime/kurifilter-plugins/ikws/searchproviderdlg.cpp \
#870405:870406 @@ -73,23 +73,28 @@
                        || m_dlg->leQuery->text().isEmpty()));
 }
 
-void SearchProviderDialog::slotOk()
-{
-    if ((m_dlg->leQuery->text().indexOf("\\{") == -1)
-        && KMessageBox::warningContinueCancel(0,
-            i18n("The URI does not contain a \\{...} placeholder for the user \
                query.\n"
-                 "This means that the same page is always going to be visited, "
-                 "regardless of what the user types."),
-            QString(), KGuiItem(i18n("Keep It"))) == KMessageBox::Cancel)
-        return;
 
-    if (!m_provider)
-        m_provider = new SearchProvider;
-    m_provider->setName(m_dlg->leName->text().trimmed());
-    m_provider->setQuery(m_dlg->leQuery->text().trimmed());
-    m_provider->setKeys(m_dlg->leShortcut->text().trimmed().split(",", \
                QString::SkipEmptyParts));
-    m_provider->setCharset(m_dlg->cbCharset->currentIndex() ? \
                m_dlg->cbCharset->currentText() : QString());
-    KDialog::accept();
+void SearchProviderDialog::slotButtonClicked(int button) {
+    if (button == KDialog::Ok) {
+        if ((m_dlg->leQuery->text().indexOf("\\{") == -1)
+            && KMessageBox::warningContinueCancel(0,
+                i18n("The URI does not contain a \\{...} placeholder for the user \
query.\n" +                    "This means that the same page is always going to be \
visited, " +                    "regardless of what the user types."),
+                QString(), KGuiItem(i18n("Keep It"))) == KMessageBox::Cancel) {
+            return;
+        }
+        
+        if (!m_provider)
+            m_provider = new SearchProvider;
+        m_provider->setName(m_dlg->leName->text().trimmed());
+        m_provider->setQuery(m_dlg->leQuery->text().trimmed());
+        m_provider->setKeys(m_dlg->leShortcut->text().trimmed().split(",", \
QString::SkipEmptyParts)); +        \
m_provider->setCharset(m_dlg->cbCharset->currentIndex() ? \
m_dlg->cbCharset->currentText() : QString()); +        KDialog::accept();
+    } else {
+        KDialog::slotButtonClicked(button);
+    }
 }
 
 #include "searchproviderdlg.moc"
--- trunk/KDE/kdebase/runtime/kurifilter-plugins/ikws/searchproviderdlg.h \
#870405:870406 @@ -45,7 +45,7 @@
 
 protected Q_SLOTS:
     void slotChanged();
-    void slotOk();
+    virtual void slotButtonClicked(int button);
 
 private:
     SearchProvider *m_provider;


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

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