summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/odict/dictwidget.cpp30
-rw-r--r--noncore/apps/odict/dictwidget.h24
-rw-r--r--noncore/apps/odict/odict.cpp2
-rw-r--r--noncore/apps/odict/odict.pro2
4 files changed, 0 insertions, 58 deletions
diff --git a/noncore/apps/odict/dictwidget.cpp b/noncore/apps/odict/dictwidget.cpp
deleted file mode 100644
index aa233c7..0000000
--- a/noncore/apps/odict/dictwidget.cpp
+++ b/dev/null
@@ -1,30 +0,0 @@
1/***************************************************************************
2 application: : ODict
3
4 begin : December 2002
5 copyright : ( C ) 2002, 2003 by Carsten Niehaus
6 email : cniehaus@handhelds.org
7 **************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * ( at your option ) any later version. *
15 * *
16 **************************************************************************/
17#include "dictwidget.h"
18
19#include <qpe/config.h>
20#include <qhbox.h>
21#include <qlabel.h>
22#include <qpushbutton.h>
23#include <qlineedit.h>
24#include <qmainwindow.h>
25#include <qstring.h>
26
27DictWidget::DictWidget() : QWidget()
28{
29}
30
diff --git a/noncore/apps/odict/dictwidget.h b/noncore/apps/odict/dictwidget.h
deleted file mode 100644
index 7a02705..0000000
--- a/noncore/apps/odict/dictwidget.h
+++ b/dev/null
@@ -1,24 +0,0 @@
1/***************************************************************************
2 * *
3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or *
6 * ( at your option ) any later version. *
7 * *
8 **************************************************************************/
9
10#include <qwidget.h>
11
12class QPopupMenu;
13class QMenuBar;
14class QHBox;
15class QPushButton;
16class QLineEdit;
17
18class DictWidget : public QWidget
19{
20 Q_OBJECT
21
22 public:
23 DictWidget();
24};
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp
index 58cff5f..a404e89 100644
--- a/noncore/apps/odict/odict.cpp
+++ b/noncore/apps/odict/odict.cpp
@@ -1,206 +1,204 @@
1/*************************************************************************** 1/***************************************************************************
2 application: : ODict 2 application: : ODict
3 3
4 begin : December 2002 4 begin : December 2002
5 copyright : ( C ) 2002, 2003 by Carsten Niehaus 5 copyright : ( C ) 2002, 2003 by Carsten Niehaus
6 email : cniehaus@handhelds.org 6 email : cniehaus@handhelds.org
7 **************************************************************************/ 7 **************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * ( at your option ) any later version. * 14 * ( at your option ) any later version. *
15 * * 15 * *
16 **************************************************************************/ 16 **************************************************************************/
17#include "odict.h" 17#include "odict.h"
18#include "configdlg.h" 18#include "configdlg.h"
19#include "dingwidget.h" 19#include "dingwidget.h"
20 20
21#include <qlayout.h> 21#include <qlayout.h>
22#include <qpopupmenu.h> 22#include <qpopupmenu.h>
23#include <qmenubar.h> 23#include <qmenubar.h>
24#include <qmessagebox.h> 24#include <qmessagebox.h>
25#include <qpe/config.h> 25#include <qpe/config.h>
26#include <qhbox.h> 26#include <qhbox.h>
27#include <qvbox.h> 27#include <qvbox.h>
28#include <qlabel.h> 28#include <qlabel.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qlineedit.h> 30#include <qlineedit.h>
31#include <qmainwindow.h> 31#include <qmainwindow.h>
32#include <qstring.h> 32#include <qstring.h>
33#include <qaction.h> 33#include <qaction.h>
34#include <qtextbrowser.h> 34#include <qtextbrowser.h>
35#include <qcombobox.h> 35#include <qcombobox.h>
36 36
37#include <qpe/resource.h> 37#include <qpe/resource.h>
38 38
39 39
40ODict::ODict() : QMainWindow() 40ODict::ODict() : QMainWindow()
41{ 41{
42 activated_name = QString::null; 42 activated_name = QString::null;
43 43
44 vbox = new QVBox( this ); 44 vbox = new QVBox( this );
45 setCaption( tr( "OPIE-Dictionary" ) ); 45 setCaption( tr( "OPIE-Dictionary" ) );
46 setupMenus(); 46 setupMenus();
47 47
48 48
49 QHBox *hbox = new QHBox( vbox ); 49 QHBox *hbox = new QHBox( vbox );
50 QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show(); 50 QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show();
51 query_le = new QLineEdit( hbox ); 51 query_le = new QLineEdit( hbox );
52 query_co = new QComboBox( hbox ); 52 query_co = new QComboBox( hbox );
53 connect( query_co , SIGNAL( activated(int) ), this, SLOT( slotMethodChanged(int) ) ); 53 connect( query_co , SIGNAL( activated(int) ), this, SLOT( slotMethodChanged(int) ) );
54 ok_button = new QPushButton( tr( "&Ok" ), hbox ); 54 ok_button = new QPushButton( tr( "&Ok" ), hbox );
55 connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); 55 connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) );
56 browser_top = new QTextBrowser( vbox ); 56 browser_top = new QTextBrowser( vbox );
57 browser_bottom = new QTextBrowser( vbox ); 57 browser_bottom = new QTextBrowser( vbox );
58 58
59 ding = new DingWidget(); 59 ding = new DingWidget();
60 ding->loadValues(); 60 ding->loadValues();
61 61
62 loadConfig(); 62 loadConfig();
63 setCentralWidget( vbox ); 63 setCentralWidget( vbox );
64} 64}
65 65
66void ODict::loadConfig() 66void ODict::loadConfig()
67{ 67{
68 Config cfg ( "odict" ); 68 Config cfg ( "odict" );
69 cfg.setGroup( "generalsettings" ); 69 cfg.setGroup( "generalsettings" );
70 errorTol = cfg.readEntry( "errtol" ).toInt(); 70 errorTol = cfg.readEntry( "errtol" ).toInt();
71 casesens = cfg.readEntry( "casesens" ).toInt(); 71 casesens = cfg.readEntry( "casesens" ).toInt();
72 regexp = cfg.readEntry( "regexp" ).toInt(); 72 regexp = cfg.readEntry( "regexp" ).toInt();
73 completewords = cfg.readEntry( "completewords" ).toInt(); 73 completewords = cfg.readEntry( "completewords" ).toInt();
74 74
75 QStringList groupListCfg = cfg.groupList().grep( "Method_" ); 75 QStringList groupListCfg = cfg.groupList().grep( "Method_" );
76 query_co->clear(); 76 query_co->clear();
77 for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) 77 for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it )
78 { 78 {
79 cfg.setGroup( *it ); 79 cfg.setGroup( *it );
80 query_co->insertItem( cfg.readEntry( "Name" ) ); 80 query_co->insertItem( cfg.readEntry( "Name" ) );
81 } 81 }
82 slotMethodChanged(1 ); //FIXME: this line should not contain a integer 82 slotMethodChanged(1 ); //FIXME: this line should not contain a integer
83} 83}
84 84
85 85
86void ODict::saveConfig() 86void ODict::saveConfig()
87{ 87{
88 Config cfg ( "odict" ); 88 Config cfg ( "odict" );
89 cfg.setGroup( "generalsettings" ); 89 cfg.setGroup( "generalsettings" );
90 cfg.writeEntry( "errtol" , errorTol ); 90 cfg.writeEntry( "errtol" , errorTol );
91 cfg.writeEntry( "casesens" , casesens ); 91 cfg.writeEntry( "casesens" , casesens );
92 cfg.writeEntry( "regexp" , regexp ); 92 cfg.writeEntry( "regexp" , regexp );
93 cfg.writeEntry( "completewords" , completewords ); 93 cfg.writeEntry( "completewords" , completewords );
94} 94}
95 95
96void ODict::slotStartQuery() 96void ODict::slotStartQuery()
97{ 97{
98 QString querystring = query_le->text(); 98 QString querystring = query_le->text();
99 //X qDebug("opening dict >%s< for >%s<", activated_name.latin1(),querystring.latin1()); 99 //X qDebug("opening dict >%s< for >%s<", activated_name.latin1(),querystring.latin1());
100 //X if (querystring.isEmpty()){ 100 //X if (querystring.isEmpty()){
101 //X qWarning("empty querystring"); 101 //X qWarning("empty querystring");
102 //X return; 102 //X return;
103 //X } 103 //X }
104 //X if (!activated_name || activated_name.isEmpty()) 104 //X if (!activated_name || activated_name.isEmpty())
105 //X QMessageBox::warning(this,tr("No Dictionary"),tr("Please choose a dictonary") ); 105 //X QMessageBox::warning(this,tr("No Dictionary"),tr("Please choose a dictonary") );
106 //X else 106 //X else
107 //X { 107 //X {
108 108
109 ding->setCaseSensitive( casesens ); 109 ding->setCaseSensitive( casesens );
110 ding->setCompleteWord( completewords ); 110 ding->setCompleteWord( completewords );
111 ding->setDict( activated_name ); 111 ding->setDict( activated_name );
112 112
113 if ( activated_name != ding->loadedDict() ) 113 if ( activated_name != ding->loadedDict() )
114 {
115 ding->loadDict(activated_name); 114 ding->loadDict(activated_name);
116 }
117 115
118 BroswerContent test = ding->setText( querystring ); 116 BroswerContent test = ding->setText( querystring );
119 117
120 browser_top->setText( test.top ); 118 browser_top->setText( test.top );
121 browser_bottom->setText( test.bottom ); 119 browser_bottom->setText( test.bottom );
122 120
123 qDebug( "Text sollte gesetzt sein..." ); 121 qDebug( "Text sollte gesetzt sein..." );
124 //X } 122 //X }
125} 123}
126 124
127 125
128void ODict::slotSetErrorcount( int count ) 126void ODict::slotSetErrorcount( int count )
129{ 127{
130 errorTol = count; 128 errorTol = count;
131} 129}
132 130
133void ODict::slotSettings() 131void ODict::slotSettings()
134{ 132{
135 ConfigDlg dlg( this, "Config" , true); 133 ConfigDlg dlg( this, "Config" , true);
136 if ( dlg.exec() == QDialog::Accepted ) 134 if ( dlg.exec() == QDialog::Accepted )
137 { 135 {
138 dlg.writeEntries(); 136 dlg.writeEntries();
139 loadConfig(); 137 loadConfig();
140 } 138 }
141 else qDebug( "abgebrochen" ); 139 else qDebug( "abgebrochen" );
142} 140}
143 141
144void ODict::slotSetParameter( int count ) 142void ODict::slotSetParameter( int count )
145{ 143{
146 if ( count == 0 ) 144 if ( count == 0 )
147 { 145 {
148 if ( casesens ) 146 if ( casesens )
149 casesens = false; 147 casesens = false;
150 else 148 else
151 casesens = true; 149 casesens = true;
152 } 150 }
153 151
154 if ( count == 1 ) 152 if ( count == 1 )
155 { 153 {
156 if ( completewords ) 154 if ( completewords )
157 completewords = false; 155 completewords = false;
158 else 156 else
159 completewords = true; 157 completewords = true;
160 } 158 }
161 if ( count == 2 ) 159 if ( count == 2 )
162 { 160 {
163 if ( regexp ) 161 if ( regexp )
164 regexp = false; 162 regexp = false;
165 else 163 else
166 regexp = true; 164 regexp = true;
167 } 165 }
168 else qWarning( "ERROR" ); 166 else qWarning( "ERROR" );
169} 167}
170 168
171void ODict::slotMethodChanged( int /*methodnumber*/ ) 169void ODict::slotMethodChanged( int /*methodnumber*/ )
172{ 170{
173 activated_name = query_co->currentText(); 171 activated_name = query_co->currentText();
174} 172}
175 173
176void ODict::setupMenus() 174void ODict::setupMenus()
177{ 175{
178 menu = new QMenuBar( this ); 176 menu = new QMenuBar( this );
179 177
180 settings = new QPopupMenu( menu ); 178 settings = new QPopupMenu( menu );
181 setting_a = new QAction(tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); 179 setting_a = new QAction(tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 );
182 connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); 180 connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
183 setting_a->addTo( settings ); 181 setting_a->addTo( settings );
184 setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); 182 setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 );
185 183
186 parameter = new QPopupMenu( menu ); 184 parameter = new QPopupMenu( menu );
187 connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); 185 connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) );
188 parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 ); 186 parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 );
189 parameter->insertItem( tr( "Only &complete Words" ), 1 , 1) ; 187 parameter->insertItem( tr( "Only &complete Words" ), 1 , 1) ;
190 parameter->insertItem( tr( "Allow &reg. expressions" ), 2 ); 188 parameter->insertItem( tr( "Allow &reg. expressions" ), 2 );
191 parameter->insertSeparator(); 189 parameter->insertSeparator();
192 error_tol_menu = new QPopupMenu( menu ); 190 error_tol_menu = new QPopupMenu( menu );
193 error_tol_menu->setCheckable( TRUE ); 191 error_tol_menu->setCheckable( TRUE );
194 connect( error_tol_menu, SIGNAL( activated( int ) ), this, SLOT( slotSetErrorcount( int ) ) ); 192 connect( error_tol_menu, SIGNAL( activated( int ) ), this, SLOT( slotSetErrorcount( int ) ) );
195 193
196 error_tol_menu->insertItem( tr( "0 Errors" ), 0 ); 194 error_tol_menu->insertItem( tr( "0 Errors" ), 0 );
197 error_tol_menu->insertItem( tr( "1 Errors" ), 1 ); 195 error_tol_menu->insertItem( tr( "1 Errors" ), 1 );
198 error_tol_menu->insertItem( tr( "2 Errors" ), 2 ); 196 error_tol_menu->insertItem( tr( "2 Errors" ), 2 );
199 error_tol_menu->insertItem( tr( "3 Errors" ), 3 ); 197 error_tol_menu->insertItem( tr( "3 Errors" ), 3 );
200 error_tol_menu->insertItem( tr( "4 Errors" ), 4 ); 198 error_tol_menu->insertItem( tr( "4 Errors" ), 4 );
201 error_tol_menu->insertItem( tr( "Until Hit" ), 5 ); 199 error_tol_menu->insertItem( tr( "Until Hit" ), 5 );
202 parameter->insertItem( tr( "&Error tolerance" ), error_tol_menu ); 200 parameter->insertItem( tr( "&Error tolerance" ), error_tol_menu );
203 201
204 menu->insertItem( tr( "Settings" ) , settings ); 202 menu->insertItem( tr( "Settings" ) , settings );
205 menu->insertItem( tr( "Parameter" ) , parameter ); 203 menu->insertItem( tr( "Parameter" ) , parameter );
206} 204}
diff --git a/noncore/apps/odict/odict.pro b/noncore/apps/odict/odict.pro
index 32f83fd..427a5c6 100644
--- a/noncore/apps/odict/odict.pro
+++ b/noncore/apps/odict/odict.pro
@@ -1,43 +1,41 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on debug 2 CONFIG = qt warn_on debug
3 #CONFIG = qt warn_on release 3 #CONFIG = qt warn_on release
4 HEADERS = odict.h \ 4 HEADERS = odict.h \
5 searchmethoddlg.h \ 5 searchmethoddlg.h \
6 configdlg.h \ 6 configdlg.h \
7 dingwidget.h \ 7 dingwidget.h \
8 dictwidget.h
9 8
10 SOURCES = main.cpp \ 9 SOURCES = main.cpp \
11 odict.cpp \ 10 odict.cpp \
12 searchmethoddlg.cpp \ 11 searchmethoddlg.cpp \
13 configdlg.cpp \ 12 configdlg.cpp \
14 dictwidget.cpp \
15 dingwidget.cpp 13 dingwidget.cpp
16INCLUDEPATH += $(OPIEDIR)/include 14INCLUDEPATH += $(OPIEDIR)/include
17DEPENDPATH += $(OPIEDIR)/include 15DEPENDPATH += $(OPIEDIR)/include
18 LIBS += -lqpe -lstdc++ -lopie 16 LIBS += -lqpe -lstdc++ -lopie
19 TARGET = odict 17 TARGET = odict
20 DESTDIR = $(OPIEDIR)/bin 18 DESTDIR = $(OPIEDIR)/bin
21 19
22TRANSLATIONS = ../../../i18n/de/odict.ts \ 20TRANSLATIONS = ../../../i18n/de/odict.ts \
23 ../../../i18n/nl/odict.ts \ 21 ../../../i18n/nl/odict.ts \
24 ../../../i18n/xx/odict.ts \ 22 ../../../i18n/xx/odict.ts \
25 ../../../i18n/en/odict.ts \ 23 ../../../i18n/en/odict.ts \
26 ../../../i18n/es/odict.ts \ 24 ../../../i18n/es/odict.ts \
27 ../../../i18n/fr/odict.ts \ 25 ../../../i18n/fr/odict.ts \
28 ../../../i18n/hu/odict.ts \ 26 ../../../i18n/hu/odict.ts \
29 ../../../i18n/ja/odict.ts \ 27 ../../../i18n/ja/odict.ts \
30 ../../../i18n/ko/odict.ts \ 28 ../../../i18n/ko/odict.ts \
31 ../../../i18n/no/odict.ts \ 29 ../../../i18n/no/odict.ts \
32 ../../../i18n/pl/odict.ts \ 30 ../../../i18n/pl/odict.ts \
33 ../../../i18n/pt/odict.ts \ 31 ../../../i18n/pt/odict.ts \
34 ../../../i18n/pt_BR/odict.ts \ 32 ../../../i18n/pt_BR/odict.ts \
35 ../../../i18n/sl/odict.ts \ 33 ../../../i18n/sl/odict.ts \
36 ../../../i18n/zh_CN/odict.ts \ 34 ../../../i18n/zh_CN/odict.ts \
37 ../../../i18n/zh_TW/odict.ts \ 35 ../../../i18n/zh_TW/odict.ts \
38 ../../../i18n/it/odict.ts \ 36 ../../../i18n/it/odict.ts \
39 ../../../i18n/da/odict.ts 37 ../../../i18n/da/odict.ts
40 38
41 39
42 40
43include ( $(OPIEDIR)/include.pro ) 41include ( $(OPIEDIR)/include.pro )