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

svn path=/trunk/kdegraphics/kdvi/; revision=407151
This commit is contained in:
Wilfried Huss 2005-04-22 14:17:06 +00:00
parent 3d173f0a85
commit 0a539c0048
2 changed files with 40 additions and 0 deletions

View file

@ -54,6 +54,8 @@ KDVIMultiPage::KDVIMultiPage(QWidget *parentWidget, const char *widgetName, QObj
performanceTimer.start();
#endif
searchUsed = false;
setInstance(KDVIMultiPageFactory::instance());
printer = 0;
@ -498,4 +500,32 @@ documentWidget* KDVIMultiPage::createDocumentWidget()
return documentWidget;
}
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"

View file

@ -59,6 +59,12 @@ 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();
void doEnableWarnings();
@ -72,6 +78,10 @@ private:
dviRenderer DVIRenderer;
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 *
*************************************************************/