summaryrefslogtreecommitdiff
authorcniehaus <cniehaus>2003-03-23 16:05:26 (UTC)
committer cniehaus <cniehaus>2003-03-23 16:05:26 (UTC)
commitd2a2f5ee260e80a166b070872cefdd35e0b0b3cd (patch) (unidiff)
tree37b422856b9be9586ee7882739d6fb7c11153a34
parent9c539b9626f0a3ffca47e9b1247cb727539b46c6 (diff)
downloadopie-d2a2f5ee260e80a166b070872cefdd35e0b0b3cd.zip
opie-d2a2f5ee260e80a166b070872cefdd35e0b0b3cd.tar.gz
opie-d2a2f5ee260e80a166b070872cefdd35e0b0b3cd.tar.bz2
remove the aboutbox
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/odict/odict.cpp5
-rw-r--r--noncore/apps/odict/odict.h1
2 files changed, 0 insertions, 6 deletions
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp
index 78c3f90..c4114f7 100644
--- a/noncore/apps/odict/odict.cpp
+++ b/noncore/apps/odict/odict.cpp
@@ -1,215 +1,210 @@
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::slotDisplayAbout()
97{
98 QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20030111" ) );
99}
100
101void ODict::slotStartQuery() 96void ODict::slotStartQuery()
102{ 97{
103 QString querystring = query_le->text(); 98 QString querystring = query_le->text();
104 //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());
105 //X if (querystring.isEmpty()){ 100 //X if (querystring.isEmpty()){
106 //X qWarning("empty querystring"); 101 //X qWarning("empty querystring");
107 //X return; 102 //X return;
108 //X } 103 //X }
109 //X if (!activated_name || activated_name.isEmpty()) 104 //X if (!activated_name || activated_name.isEmpty())
110 //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") );
111 //X else 106 //X else
112 //X { 107 //X {
113 108
114 ding->setCaseSensitive( casesens ); 109 ding->setCaseSensitive( casesens );
115 ding->setCompleteWord( completewords ); 110 ding->setCompleteWord( completewords );
116 ding->setDict( activated_name ); 111 ding->setDict( activated_name );
117 112
118 if ( activated_name != ding->loadedDict() ) 113 if ( activated_name != ding->loadedDict() )
119 { 114 {
120 ding->loadDict(activated_name); 115 ding->loadDict(activated_name);
121 } 116 }
122 117
123 BroswerContent test = ding->setText( querystring ); 118 BroswerContent test = ding->setText( querystring );
124 119
125 browser_top->setText( test.top ); 120 browser_top->setText( test.top );
126 browser_bottom->setText( test.bottom ); 121 browser_bottom->setText( test.bottom );
127 122
128 qDebug( "Text sollte gesetzt sein..." ); 123 qDebug( "Text sollte gesetzt sein..." );
129 //X } 124 //X }
130} 125}
131 126
132 127
133void ODict::slotSetErrorcount( int count ) 128void ODict::slotSetErrorcount( int count )
134{ 129{
135 errorTol = count; 130 errorTol = count;
136} 131}
137 132
138void ODict::slotSettings() 133void ODict::slotSettings()
139{ 134{
140 ConfigDlg dlg( this, "Config" , true); 135 ConfigDlg dlg( this, "Config" , true);
141 if ( dlg.exec() == QDialog::Accepted ) 136 if ( dlg.exec() == QDialog::Accepted )
142 { 137 {
143 dlg.writeEntries(); 138 dlg.writeEntries();
144 loadConfig(); 139 loadConfig();
145 } 140 }
146 else qDebug( "abgebrochen" ); 141 else qDebug( "abgebrochen" );
147} 142}
148 143
149void ODict::slotSetParameter( int count ) 144void ODict::slotSetParameter( int count )
150{ 145{
151 if ( count == 0 ) 146 if ( count == 0 )
152 { 147 {
153 if ( casesens ) 148 if ( casesens )
154 casesens = false; 149 casesens = false;
155 else 150 else
156 casesens = true; 151 casesens = true;
157 } 152 }
158 153
159 if ( count == 1 ) 154 if ( count == 1 )
160 { 155 {
161 if ( completewords ) 156 if ( completewords )
162 completewords = false; 157 completewords = false;
163 else 158 else
164 completewords = true; 159 completewords = true;
165 } 160 }
166 if ( count == 2 ) 161 if ( count == 2 )
167 { 162 {
168 if ( regexp ) 163 if ( regexp )
169 regexp = false; 164 regexp = false;
170 else 165 else
171 regexp = true; 166 regexp = true;
172 } 167 }
173 else qWarning( "ERROR" ); 168 else qWarning( "ERROR" );
174} 169}
175 170
176void ODict::slotMethodChanged( int /*methodnumber*/ ) 171void ODict::slotMethodChanged( int /*methodnumber*/ )
177{ 172{
178 activated_name = query_co->currentText(); 173 activated_name = query_co->currentText();
179} 174}
180 175
181void ODict::setupMenus() 176void ODict::setupMenus()
182{ 177{
183 menu = new QMenuBar( this ); 178 menu = new QMenuBar( this );
184 179
185 settings = new QPopupMenu( menu ); 180 settings = new QPopupMenu( menu );
186 setting_a = new QAction(tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); 181 setting_a = new QAction(tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 );
187 connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); 182 connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
188 setting_a->addTo( settings ); 183 setting_a->addTo( settings );
189 setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); 184 setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 );
190 185
191 parameter = new QPopupMenu( menu ); 186 parameter = new QPopupMenu( menu );
192 connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); 187 connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) );
193 parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 ); 188 parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 );
194 parameter->insertItem( tr( "Only &complete Words" ), 1 , 1) ; 189 parameter->insertItem( tr( "Only &complete Words" ), 1 , 1) ;
195 parameter->insertItem( tr( "Allow &reg. expressions" ), 2 ); 190 parameter->insertItem( tr( "Allow &reg. expressions" ), 2 );
196 parameter->insertSeparator(); 191 parameter->insertSeparator();
197 error_tol_menu = new QPopupMenu( menu ); 192 error_tol_menu = new QPopupMenu( menu );
198 error_tol_menu->setCheckable( TRUE ); 193 error_tol_menu->setCheckable( TRUE );
199 connect( error_tol_menu, SIGNAL( activated( int ) ), this, SLOT( slotSetErrorcount( int ) ) ); 194 connect( error_tol_menu, SIGNAL( activated( int ) ), this, SLOT( slotSetErrorcount( int ) ) );
200 195
201 error_tol_menu->insertItem( tr( "0 Errors" ), 0 ); 196 error_tol_menu->insertItem( tr( "0 Errors" ), 0 );
202 error_tol_menu->insertItem( tr( "1 Errors" ), 1 ); 197 error_tol_menu->insertItem( tr( "1 Errors" ), 1 );
203 error_tol_menu->insertItem( tr( "2 Errors" ), 2 ); 198 error_tol_menu->insertItem( tr( "2 Errors" ), 2 );
204 error_tol_menu->insertItem( tr( "3 Errors" ), 3 ); 199 error_tol_menu->insertItem( tr( "3 Errors" ), 3 );
205 error_tol_menu->insertItem( tr( "4 Errors" ), 4 ); 200 error_tol_menu->insertItem( tr( "4 Errors" ), 4 );
206 error_tol_menu->insertItem( tr( "Until Hit" ), 5 ); 201 error_tol_menu->insertItem( tr( "Until Hit" ), 5 );
207 parameter->insertItem( tr( "&Error tolerance" ), error_tol_menu ); 202 parameter->insertItem( tr( "&Error tolerance" ), error_tol_menu );
208 203
209 help = new QPopupMenu( menu ); 204 help = new QPopupMenu( menu );
210 help->insertItem("&About",this,SLOT( slotDisplayAbout() )); 205 help->insertItem("&About",this,SLOT( slotDisplayAbout() ));
211 206
212 menu->insertItem( tr( "Settings" ) , settings ); 207 menu->insertItem( tr( "Settings" ) , settings );
213 menu->insertItem( tr( "Parameter" ) , parameter ); 208 menu->insertItem( tr( "Parameter" ) , parameter );
214 menu->insertItem( tr( "Help" ) , help ); 209 menu->insertItem( tr( "Help" ) , help );
215} 210}
diff --git a/noncore/apps/odict/odict.h b/noncore/apps/odict/odict.h
index b20c165..3065feb 100644
--- a/noncore/apps/odict/odict.h
+++ b/noncore/apps/odict/odict.h
@@ -1,66 +1,65 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 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 * 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 * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * ( at your option ) any later version. * 6 * ( at your option ) any later version. *
7 * * 7 * *
8 **************************************************************************/ 8 **************************************************************************/
9 9
10#include <qmainwindow.h> 10#include <qmainwindow.h>
11 11
12class QVBox; 12class QVBox;
13class QPopupMenu; 13class QPopupMenu;
14class QMenuBar; 14class QMenuBar;
15class QHBox; 15class QHBox;
16class QPushButton; 16class QPushButton;
17class QLineEdit; 17class QLineEdit;
18class QAction; 18class QAction;
19class QVBoxLayout; 19class QVBoxLayout;
20class QActionGroup; 20class QActionGroup;
21class DingWidget; 21class DingWidget;
22class QTextBrowser; 22class QTextBrowser;
23class QComboBox; 23class QComboBox;
24class DingWidget; 24class DingWidget;
25 25
26class ODict : public QMainWindow 26class ODict : public QMainWindow
27{ 27{
28 Q_OBJECT 28 Q_OBJECT
29 29
30 public: 30 public:
31 ODict(); 31 ODict();
32 QVBox *vbox; 32 QVBox *vbox;
33 QTextBrowser *browser_top, 33 QTextBrowser *browser_top,
34 *browser_bottom; 34 *browser_bottom;
35 DingWidget *ding; 35 DingWidget *ding;
36 36
37 private: 37 private:
38 QPopupMenu *help, *settings, *parameter, *error_tol_menu; 38 QPopupMenu *help, *settings, *parameter, *error_tol_menu;
39 QMenuBar *menu; 39 QMenuBar *menu;
40 QHBox *hbox; 40 QHBox *hbox;
41 QLineEdit *query_le; 41 QLineEdit *query_le;
42 QComboBox *query_co; 42 QComboBox *query_co;
43 QPushButton *ok_button; 43 QPushButton *ok_button;
44 44
45 QVBoxLayout *vbox_layout; 45 QVBoxLayout *vbox_layout;
46 46
47 QAction *setting_a, *setting_b; 47 QAction *setting_a, *setting_b;
48 48
49 void setupMenus(); 49 void setupMenus();
50 50
51 int errorTol; 51 int errorTol;
52 bool casesens, completewords, regexp; 52 bool casesens, completewords, regexp;
53 53
54 void loadConfig(); 54 void loadConfig();
55 void saveConfig(); 55 void saveConfig();
56 56
57 QString activated_name; 57 QString activated_name;
58 58
59 private slots: 59 private slots:
60 void slotDisplayAbout();
61 void slotStartQuery(); 60 void slotStartQuery();
62 void slotSetErrorcount( int ); 61 void slotSetErrorcount( int );
63 void slotSettings(); 62 void slotSettings();
64 void slotSetParameter( int ); 63 void slotSetParameter( int );
65 void slotMethodChanged( int ); 64 void slotMethodChanged( int );
66}; 65};