summaryrefslogtreecommitdiff
authortille <tille>2003-01-04 12:27:56 (UTC)
committer tille <tille>2003-01-04 12:27:56 (UTC)
commit969924a9d896b70141758b734d898b4423dac357 (patch) (unidiff)
tree8af7ca893a9c83454520fa93a819fcb562b569ce
parentadbf1d5e2eb8b78e9a8f117fc085aa89f984d4bc (diff)
downloadopie-969924a9d896b70141758b734d898b4423dac357.zip
opie-969924a9d896b70141758b734d898b4423dac357.tar.gz
opie-969924a9d896b70141758b734d898b4423dac357.tar.bz2
check for querystring and dictionary
and display msgbox
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/odict/odict.cpp10
-rw-r--r--noncore/apps/odict/odict.pro3
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()
50 query_le = new QLineEdit( hbox ); 50 query_le = new QLineEdit( hbox );
51 query_co = new QComboBox( hbox ); 51 query_co = new QComboBox( hbox );
52 connect( query_co , SIGNAL( activated(int) ), this, SLOT( slotMethodChanged(int) ) ); 52 connect( query_co , SIGNAL( activated(int) ), this, SLOT( slotMethodChanged(int) ) );
53 ok_button = new QPushButton( tr( "&Ok" ), hbox ); 53 ok_button = new QPushButton( tr( "&Ok" ), hbox );
54 connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); 54 connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) );
55 browser_top = new QTextBrowser( vbox ); 55 browser_top = new QTextBrowser( vbox );
56 browser_bottom = new QTextBrowser( vbox ); 56 browser_bottom = new QTextBrowser( vbox );
57 57
58 loadConfig(); 58 loadConfig();
59 setCentralWidget( vbox ); 59 setCentralWidget( vbox );
60} 60}
61 61
62void ODict::loadConfig() 62void ODict::loadConfig()
63{ 63{
64 Config cfg ( "odict" ); 64 Config cfg ( "odict" );
65 cfg.setGroup( "generalsettings" ); 65 cfg.setGroup( "generalsettings" );
66 errorTol = cfg.readEntry( "errtol" ).toInt(); 66 errorTol = cfg.readEntry( "errtol" ).toInt();
67 casesens = cfg.readEntry( "casesens" ).toInt(); 67 casesens = cfg.readEntry( "casesens" ).toInt();
68 regexp = cfg.readEntry( "regexp" ).toInt(); 68 regexp = cfg.readEntry( "regexp" ).toInt();
69 completewords = cfg.readEntry( "completewords" ).toInt(); 69 completewords = cfg.readEntry( "completewords" ).toInt();
70 70
71 QStringList groupListCfg = cfg.groupList().grep( "Method_" ); 71 QStringList groupListCfg = cfg.groupList().grep( "Method_" );
72 for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) 72 for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it )
73 { 73 {
74 cfg.setGroup( *it ); 74 cfg.setGroup( *it );
75 query_co->insertItem( cfg.readEntry( "Name" ) ); 75 query_co->insertItem( cfg.readEntry( "Name" ) );
76 } 76 }
77} 77}
78 78
79 79
80void ODict::saveConfig() 80void ODict::saveConfig()
81{ 81{
82 Config cfg ( "odict" ); 82 Config cfg ( "odict" );
83 cfg.setGroup( "generalsettings" ); 83 cfg.setGroup( "generalsettings" );
84 cfg.writeEntry( "errtol" , errorTol ); 84 cfg.writeEntry( "errtol" , errorTol );
85 cfg.writeEntry( "casesens" , casesens ); 85 cfg.writeEntry( "casesens" , casesens );
86 cfg.writeEntry( "regexp" , regexp ); 86 cfg.writeEntry( "regexp" , regexp );
87 cfg.writeEntry( "completewords" , completewords ); 87 cfg.writeEntry( "completewords" , completewords );
88} 88}
89 89
90void ODict::slotDisplayAbout() 90void ODict::slotDisplayAbout()
91{ 91{
92 QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20030103" ) ); 92 QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20030103" ) );
93} 93}
94 94
95void ODict::slotStartQuery() 95void ODict::slotStartQuery()
96{ 96{
97 QString querystring = query_le->text(); 97 QString querystring = query_le->text();
98 DingWidget *ding = new DingWidget( vbox , querystring , browser_top, browser_bottom, activated_name); 98 qDebug("opening dict >%s< for >%s<", activated_name.latin1(),querystring.latin1());
99 if (querystring.isEmpty()){
100 qWarning("emphty querysting");
101 return;
102 }
103 if (!activated_name || activated_name.isEmpty())
104 QMessageBox::warning(this,tr("No Dictionary"),tr("Please choose a dictonary") );
105 else
106 DingWidget *ding = new DingWidget( vbox , querystring , browser_top, browser_bottom, activated_name);
99} 107}
100 108
101 109
102void ODict::slotSetErrorcount( int count ) 110void ODict::slotSetErrorcount( int count )
103{ 111{
104 errorTol = count; 112 errorTol = count;
105} 113}
106 114
107void ODict::slotSettings() 115void ODict::slotSettings()
108{ 116{
109 ConfigDlg dlg( this, "Config" , true); 117 ConfigDlg dlg( this, "Config" , true);
110 if ( dlg.exec() == QDialog::Accepted ) 118 if ( dlg.exec() == QDialog::Accepted )
111 dlg.writeEntries(); 119 dlg.writeEntries();
112 else qDebug( "abgebrochen" ); 120 else qDebug( "abgebrochen" );
113} 121}
114 122
115void ODict::slotSetParameter( int count ) 123void ODict::slotSetParameter( int count )
116{ 124{
117 if ( count == 0 ) 125 if ( count == 0 )
118 { 126 {
119 if ( casesens ) 127 if ( casesens )
120 casesens = false; 128 casesens = false;
121 else 129 else
122 casesens = true; 130 casesens = true;
123 } 131 }
124 132
125 if ( count == 1 ) 133 if ( count == 1 )
126 { 134 {
127 if ( completewords ) 135 if ( completewords )
128 completewords = false; 136 completewords = false;
129 else 137 else
130 completewords = true; 138 completewords = true;
131 } 139 }
132 if ( count == 2 ) 140 if ( count == 2 )
133 { 141 {
134 if ( regexp ) 142 if ( regexp )
135 regexp = false; 143 regexp = false;
136 else 144 else
137 regexp = true; 145 regexp = true;
138 } 146 }
139 else qWarning( "ERROR" ); 147 else qWarning( "ERROR" );
140} 148}
141 149
142void ODict::slotMethodChanged( int methodnumber ) 150void ODict::slotMethodChanged( int methodnumber )
143{ 151{
144 activated_name = query_co->currentText(); 152 activated_name = query_co->currentText();
145} 153}
146 154
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 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on release 2 CONFIG = qt warn_on debug
3 #CONFIG = qt warn_on release
3 HEADERS = odict.h \ 4 HEADERS = odict.h \
4 searchmethoddlg.h \ 5 searchmethoddlg.h \
5 configdlg.h \ 6 configdlg.h \
6 dingwidget.h \ 7 dingwidget.h \
7 dictwidget.h 8 dictwidget.h
8 9
9 SOURCES = main.cpp \ 10 SOURCES = main.cpp \
10 odict.cpp \ 11 odict.cpp \
11 searchmethoddlg.cpp \ 12 searchmethoddlg.cpp \
12 configdlg.cpp \ 13 configdlg.cpp \
13 dictwidget.cpp \ 14 dictwidget.cpp \
14 dingwidget.cpp 15 dingwidget.cpp
15INCLUDEPATH += $(OPIEDIR)/include 16INCLUDEPATH += $(OPIEDIR)/include
16DEPENDPATH += $(OPIEDIR)/include 17DEPENDPATH += $(OPIEDIR)/include
17 LIBS += -lqpe -lstdc++ -lopie 18 LIBS += -lqpe -lstdc++ -lopie
18 TARGET = odict 19 TARGET = odict
19 DESTDIR = $(OPIEDIR)/bin 20 DESTDIR = $(OPIEDIR)/bin
20 21
21TRANSLATIONS = ../../../i18n/de/odict.ts \ 22TRANSLATIONS = ../../../i18n/de/odict.ts \
22 ../../../i18n/xx/odict.ts \ 23 ../../../i18n/xx/odict.ts \
23 ../../../i18n/en/odict.ts \ 24 ../../../i18n/en/odict.ts \
24 ../../../i18n/es/odict.ts \ 25 ../../../i18n/es/odict.ts \
25 ../../../i18n/fr/odict.ts \ 26 ../../../i18n/fr/odict.ts \
26 ../../../i18n/hu/odict.ts \ 27 ../../../i18n/hu/odict.ts \
27 ../../../i18n/ja/odict.ts \ 28 ../../../i18n/ja/odict.ts \
28 ../../../i18n/ko/odict.ts \ 29 ../../../i18n/ko/odict.ts \
29 ../../../i18n/no/odict.ts \ 30 ../../../i18n/no/odict.ts \
30 ../../../i18n/pl/odict.ts \ 31 ../../../i18n/pl/odict.ts \
31 ../../../i18n/pt/odict.ts \ 32 ../../../i18n/pt/odict.ts \
32 ../../../i18n/pt_BR/odict.ts \ 33 ../../../i18n/pt_BR/odict.ts \
33 ../../../i18n/sl/odict.ts \ 34 ../../../i18n/sl/odict.ts \
34 ../../../i18n/zh_CN/odict.ts \ 35 ../../../i18n/zh_CN/odict.ts \
35 ../../../i18n/zh_TW/odict.ts \ 36 ../../../i18n/zh_TW/odict.ts \
36 ../../../i18n/it/odict.ts \ 37 ../../../i18n/it/odict.ts \
37 ../../../i18n/da/odict.ts 38 ../../../i18n/da/odict.ts