author | tille <tille> | 2003-01-04 12:27:56 (UTC) |
---|---|---|
committer | tille <tille> | 2003-01-04 12:27:56 (UTC) |
commit | 969924a9d896b70141758b734d898b4423dac357 (patch) (side-by-side diff) | |
tree | 8af7ca893a9c83454520fa93a819fcb562b569ce | |
parent | adbf1d5e2eb8b78e9a8f117fc085aa89f984d4bc (diff) | |
download | opie-969924a9d896b70141758b734d898b4423dac357.zip opie-969924a9d896b70141758b734d898b4423dac357.tar.gz opie-969924a9d896b70141758b734d898b4423dac357.tar.bz2 |
check for querystring and dictionary
and display msgbox
-rw-r--r-- | noncore/apps/odict/odict.cpp | 10 | ||||
-rw-r--r-- | noncore/apps/odict/odict.pro | 3 |
2 files changed, 11 insertions, 2 deletions
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp index 2857c65..e2d1d7b 100644 --- a/noncore/apps/odict/odict.cpp +++ b/noncore/apps/odict/odict.cpp @@ -50,97 +50,105 @@ ODict::ODict() : QMainWindow() query_le = new QLineEdit( hbox ); query_co = new QComboBox( hbox ); connect( query_co , SIGNAL( activated(int) ), this, SLOT( slotMethodChanged(int) ) ); ok_button = new QPushButton( tr( "&Ok" ), hbox ); connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); browser_top = new QTextBrowser( vbox ); browser_bottom = new QTextBrowser( vbox ); loadConfig(); setCentralWidget( vbox ); } void ODict::loadConfig() { Config cfg ( "odict" ); cfg.setGroup( "generalsettings" ); errorTol = cfg.readEntry( "errtol" ).toInt(); casesens = cfg.readEntry( "casesens" ).toInt(); regexp = cfg.readEntry( "regexp" ).toInt(); completewords = cfg.readEntry( "completewords" ).toInt(); QStringList groupListCfg = cfg.groupList().grep( "Method_" ); for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) { cfg.setGroup( *it ); query_co->insertItem( cfg.readEntry( "Name" ) ); } } void ODict::saveConfig() { Config cfg ( "odict" ); cfg.setGroup( "generalsettings" ); cfg.writeEntry( "errtol" , errorTol ); cfg.writeEntry( "casesens" , casesens ); cfg.writeEntry( "regexp" , regexp ); cfg.writeEntry( "completewords" , completewords ); } void ODict::slotDisplayAbout() { QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20030103" ) ); } void ODict::slotStartQuery() { QString querystring = query_le->text(); - DingWidget *ding = new DingWidget( vbox , querystring , browser_top, browser_bottom, activated_name); + qDebug("opening dict >%s< for >%s<", activated_name.latin1(),querystring.latin1()); + if (querystring.isEmpty()){ + qWarning("emphty querysting"); + return; + } + if (!activated_name || activated_name.isEmpty()) + QMessageBox::warning(this,tr("No Dictionary"),tr("Please choose a dictonary") ); + else + DingWidget *ding = new DingWidget( vbox , querystring , browser_top, browser_bottom, activated_name); } void ODict::slotSetErrorcount( int count ) { errorTol = count; } void ODict::slotSettings() { ConfigDlg dlg( this, "Config" , true); if ( dlg.exec() == QDialog::Accepted ) dlg.writeEntries(); else qDebug( "abgebrochen" ); } void ODict::slotSetParameter( int count ) { if ( count == 0 ) { if ( casesens ) casesens = false; else casesens = true; } if ( count == 1 ) { if ( completewords ) completewords = false; else completewords = true; } if ( count == 2 ) { if ( regexp ) regexp = false; else regexp = true; } else qWarning( "ERROR" ); } void ODict::slotMethodChanged( int methodnumber ) { activated_name = query_co->currentText(); } diff --git a/noncore/apps/odict/odict.pro b/noncore/apps/odict/odict.pro index e39fa95..23ef0e0 100644 --- a/noncore/apps/odict/odict.pro +++ b/noncore/apps/odict/odict.pro @@ -1,37 +1,38 @@ TEMPLATE = app -CONFIG = qt warn_on release +CONFIG = qt warn_on debug +#CONFIG = qt warn_on release HEADERS = odict.h \ searchmethoddlg.h \ configdlg.h \ dingwidget.h \ dictwidget.h SOURCES = main.cpp \ odict.cpp \ searchmethoddlg.cpp \ configdlg.cpp \ dictwidget.cpp \ dingwidget.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lstdc++ -lopie TARGET = odict DESTDIR = $(OPIEDIR)/bin TRANSLATIONS = ../../../i18n/de/odict.ts \ ../../../i18n/xx/odict.ts \ ../../../i18n/en/odict.ts \ ../../../i18n/es/odict.ts \ ../../../i18n/fr/odict.ts \ ../../../i18n/hu/odict.ts \ ../../../i18n/ja/odict.ts \ ../../../i18n/ko/odict.ts \ ../../../i18n/no/odict.ts \ ../../../i18n/pl/odict.ts \ ../../../i18n/pt/odict.ts \ ../../../i18n/pt_BR/odict.ts \ ../../../i18n/sl/odict.ts \ ../../../i18n/zh_CN/odict.ts \ ../../../i18n/zh_TW/odict.ts \ ../../../i18n/it/odict.ts \ ../../../i18n/da/odict.ts |