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

List:       kde-commits
Subject:    kdegraphics/kdvi
From:       Wilfried Huss <Wilfried.Huss () gmx ! at>
Date:       2005-04-22 14:17:07
Message-ID: 20050422141707.A51605FA () office ! kde ! org
[Download RAW message or body]

CVS commit by whuss: 

Show a warning message if the user activates search for the first time.


  M +30 -0     kdvi_multipage.cpp   1.176
  M +10 -0     kdvi_multipage.h   1.65


--- kdegraphics/kdvi/kdvi_multipage.cpp  #1.175:1.176
@@ -55,4 +55,6 @@ KDVIMultiPage::KDVIMultiPage(QWidget *pa
 #endif
 
+  searchUsed = false;
+
   setInstance(KDVIMultiPageFactory::instance());
 
@@ -499,3 +501,31 @@ documentWidget* KDVIMultiPage::createDoc
 }
 
+
+void KDVIMultiPage::showFindTextDialog()
+{
+  if ((getRenderer().isNull()) || (getRenderer()->supportsTextSearch() == false))
+    return;
+
+  if (!searchUsed)
+  {
+    // WARNING: This text appears several times in the code. Change
+    // everywhere, or nowhere!
+    if (KMessageBox::warningContinueCancel( scrollView(), 
+                                            i18n("<qt>This function searches the DVI \
file for plain text. Unfortunately, this version of " +                               \
"KDVI treats only plain ASCII characters properly. Symbols, ligatures, mathematical " \
+                                                 "formulae, accented characters, and \
non-english text, such as Russian or Korean, will " +                                 \
"most likely be messed up completely. Continue anyway?</qt>"), +                      \
i18n("Function May Not Work as Expected"), +                                          \
KStdGuiItem::cont(), +                                            \
"warning_search_text_may_not_work") == KMessageBox::Cancel) +      return;
+
+    // Remember that we don't need to show the warning message again.
+    searchUsed = true;
+  }
+
+  // Now really show the search widget
+  KMultiPage::showFindTextDialog();
+}
+
 #include "kdvi_multipage.moc"

--- kdegraphics/kdvi/kdvi_multipage.h  #1.64:1.65
@@ -60,4 +60,10 @@ public slots:
   virtual void preferencesChanged();
 
+  /** Shows the "text search" dialog, if text search is supported by
+      the renderer. Otherwise, the method returns immediately.
+      We reimplement this slot to show a warning message that informs the
+      user about the currently limited search capabilities of KDVI. */
+  virtual void showFindTextDialog();
+
 protected slots:
   void doExportText();
@@ -73,4 +79,8 @@ private:
   KPrinter        *printer;
 
+  // Set to true if we used the search function atleast once.
+  // It is used to remember if we already have show the warning message.
+  bool searchUsed;
+
   /*************************************************************
    * Methods and classes concerned with the find functionality *


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

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