author | cniehaus <cniehaus> | 2003-01-03 23:21:47 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2003-01-03 23:21:47 (UTC) |
commit | 004a8ac1b25530801f68d4a041b4355ecc60c9eb (patch) (unidiff) | |
tree | d850779620bf96977c68721ff1964762860df802 /noncore/apps/odict/odict.cpp | |
parent | 28b06247aaa55f80d91be1f8591e2cc30bac29d3 (diff) | |
download | opie-004a8ac1b25530801f68d4a041b4355ecc60c9eb.zip opie-004a8ac1b25530801f68d4a041b4355ecc60c9eb.tar.gz opie-004a8ac1b25530801f68d4a041b4355ecc60c9eb.tar.bz2 |
update tille
-rw-r--r-- | noncore/apps/odict/odict.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp index 7de9169..2857c65 100644 --- a/noncore/apps/odict/odict.cpp +++ b/noncore/apps/odict/odict.cpp | |||
@@ -30,32 +30,35 @@ | |||
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 | ||
40 | ODict::ODict() : QMainWindow() | 40 | ODict::ODict() : QMainWindow() |
41 | { | 41 | { |
42 | |||
43 | activated_name = QString::null; | ||
42 | vbox = new QVBox( this ); | 44 | vbox = new QVBox( this ); |
43 | setCaption( tr( "OPIE-Dictionary" ) ); | 45 | setCaption( tr( "OPIE-Dictionary" ) ); |
44 | setupMenus(); | 46 | setupMenus(); |
45 | 47 | ||
46 | QHBox *hbox = new QHBox( vbox ); | 48 | QHBox *hbox = new QHBox( vbox ); |
47 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show(); | 49 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show(); |
48 | query_le = new QLineEdit( hbox ); | 50 | query_le = new QLineEdit( hbox ); |
49 | query_co = new QComboBox( hbox ); | 51 | query_co = new QComboBox( hbox ); |
52 | connect( query_co , SIGNAL( activated(int) ), this, SLOT( slotMethodChanged(int) ) ); | ||
50 | ok_button = new QPushButton( tr( "&Ok" ), hbox ); | 53 | ok_button = new QPushButton( tr( "&Ok" ), hbox ); |
51 | connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); | 54 | connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); |
52 | browser_top = new QTextBrowser( vbox ); | 55 | browser_top = new QTextBrowser( vbox ); |
53 | browser_bottom = new QTextBrowser( vbox ); | 56 | browser_bottom = new QTextBrowser( vbox ); |
54 | 57 | ||
55 | loadConfig(); | 58 | loadConfig(); |
56 | setCentralWidget( vbox ); | 59 | setCentralWidget( vbox ); |
57 | } | 60 | } |
58 | 61 | ||
59 | void ODict::loadConfig() | 62 | void ODict::loadConfig() |
60 | { | 63 | { |
61 | Config cfg ( "odict" ); | 64 | Config cfg ( "odict" ); |
@@ -83,25 +86,25 @@ void ODict::saveConfig() | |||
83 | cfg.writeEntry( "regexp" , regexp ); | 86 | cfg.writeEntry( "regexp" , regexp ); |
84 | cfg.writeEntry( "completewords" , completewords ); | 87 | cfg.writeEntry( "completewords" , completewords ); |
85 | } | 88 | } |
86 | 89 | ||
87 | void ODict::slotDisplayAbout() | 90 | void ODict::slotDisplayAbout() |
88 | { | 91 | { |
89 | 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" ) ); |
90 | } | 93 | } |
91 | 94 | ||
92 | void ODict::slotStartQuery() | 95 | void ODict::slotStartQuery() |
93 | { | 96 | { |
94 | QString querystring = query_le->text(); | 97 | QString querystring = query_le->text(); |
95 | DingWidget *ding = new DingWidget( vbox , querystring , browser_top, browser_bottom); | 98 | DingWidget *ding = new DingWidget( vbox , querystring , browser_top, browser_bottom, activated_name); |
96 | } | 99 | } |
97 | 100 | ||
98 | 101 | ||
99 | void ODict::slotSetErrorcount( int count ) | 102 | void ODict::slotSetErrorcount( int count ) |
100 | { | 103 | { |
101 | errorTol = count; | 104 | errorTol = count; |
102 | } | 105 | } |
103 | 106 | ||
104 | void ODict::slotSettings() | 107 | void ODict::slotSettings() |
105 | { | 108 | { |
106 | ConfigDlg dlg( this, "Config" , true); | 109 | ConfigDlg dlg( this, "Config" , true); |
107 | if ( dlg.exec() == QDialog::Accepted ) | 110 | if ( dlg.exec() == QDialog::Accepted ) |
@@ -127,24 +130,29 @@ void ODict::slotSetParameter( int count ) | |||
127 | completewords = true; | 130 | completewords = true; |
128 | } | 131 | } |
129 | if ( count == 2 ) | 132 | if ( count == 2 ) |
130 | { | 133 | { |
131 | if ( regexp ) | 134 | if ( regexp ) |
132 | regexp = false; | 135 | regexp = false; |
133 | else | 136 | else |
134 | regexp = true; | 137 | regexp = true; |
135 | } | 138 | } |
136 | else qWarning( "ERROR" ); | 139 | else qWarning( "ERROR" ); |
137 | } | 140 | } |
138 | 141 | ||
142 | void ODict::slotMethodChanged( int methodnumber ) | ||
143 | { | ||
144 | activated_name = query_co->currentText(); | ||
145 | } | ||
146 | |||
139 | void ODict::setupMenus() | 147 | void ODict::setupMenus() |
140 | { | 148 | { |
141 | menu = new QMenuBar( this ); | 149 | menu = new QMenuBar( this ); |
142 | 150 | ||
143 | settings = new QPopupMenu( menu ); | 151 | settings = new QPopupMenu( menu ); |
144 | setting_a = new QAction(tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); | 152 | setting_a = new QAction(tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); |
145 | connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 153 | connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
146 | setting_a->addTo( settings ); | 154 | setting_a->addTo( settings ); |
147 | setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); | 155 | setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 ); |
148 | 156 | ||
149 | parameter = new QPopupMenu( menu ); | 157 | parameter = new QPopupMenu( menu ); |
150 | connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); | 158 | connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); |