author | mickeyl <mickeyl> | 2003-10-27 19:51:32 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-27 19:51:32 (UTC) |
commit | 951d1d4125a80dc814f95d2956853bf53ca52e9a (patch) (unidiff) | |
tree | 46c7a70b80a7eebb54cd59c46204c28335f3821c /noncore/apps/odict/odict.cpp | |
parent | f0a15a9866f9eddfe10596e63a1e6300b92b9e3f (diff) | |
download | opie-951d1d4125a80dc814f95d2956853bf53ca52e9a.zip opie-951d1d4125a80dc814f95d2956853bf53ca52e9a.tar.gz opie-951d1d4125a80dc814f95d2956853bf53ca52e9a.tar.bz2 |
merge noncore/apps/* except
- advancedfm (ljp, please...)
- odict (tille, please...)
Diffstat (limited to 'noncore/apps/odict/odict.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/odict/odict.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp index 010545e..9718c5c 100644 --- a/noncore/apps/odict/odict.cpp +++ b/noncore/apps/odict/odict.cpp | |||
@@ -33,29 +33,29 @@ | |||
33 | #include <qtextbrowser.h> | 33 | #include <qtextbrowser.h> |
34 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
35 | 35 | ||
36 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
37 | #include <qpe/config.h> | 37 | #include <qpe/config.h> |
38 | 38 | ||
39 | ODict::ODict() : QMainWindow() | 39 | ODict::ODict(QWidget* parent, const char* name, WFlags fl ) : QMainWindow(parent, name, fl ) |
40 | { | 40 | { |
41 | activated_name = QString::null; | 41 | activated_name = QString::null; |
42 | 42 | ||
43 | vbox = new QVBox( this ); | 43 | vbox = new QVBox( this ); |
44 | setCaption( tr( "Opie-Dictionary" ) ); | 44 | setCaption( tr( "Opie-Dictionary" ) ); |
45 | setupMenus(); | 45 | setupMenus(); |
46 | 46 | ||
47 | QHBox *hbox = new QHBox( vbox ); | 47 | QHBox *hbox = new QHBox( vbox ); |
48 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); | 48 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); |
49 | query_label->show(); | 49 | query_label->show(); |
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(const QString&) ), this, SLOT( slotMethodChanged(const QString&) ) ); | 52 | connect( query_co , SIGNAL( activated(const QString&) ), this, SLOT( slotMethodChanged(const QString&) ) ); |
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 | 55 | ||
56 | top_name = new QLabel( vbox ); | 56 | top_name = new QLabel( vbox ); |
57 | top_name->setAlignment( AlignHCenter ); | 57 | top_name->setAlignment( AlignHCenter ); |
58 | browser_top = new QTextBrowser( vbox ); | 58 | browser_top = new QTextBrowser( vbox ); |
59 | bottom_name = new QLabel( vbox ); | 59 | bottom_name = new QLabel( vbox ); |
60 | bottom_name->setAlignment( AlignHCenter ); | 60 | bottom_name->setAlignment( AlignHCenter ); |
61 | browser_bottom = new QTextBrowser( vbox ); | 61 | browser_bottom = new QTextBrowser( vbox ); |
@@ -69,20 +69,20 @@ ODict::ODict() : QMainWindow() | |||
69 | void ODict::loadConfig() | 69 | void ODict::loadConfig() |
70 | { | 70 | { |
71 | /* | 71 | /* |
72 | * the name of the last used dictionary | 72 | * the name of the last used dictionary |
73 | */ | 73 | */ |
74 | QString lastname; | 74 | QString lastname; |
75 | 75 | ||
76 | Config cfg ( "odict" ); | 76 | Config cfg ( "odict" ); |
77 | cfg.setGroup( "generalsettings" ); | 77 | cfg.setGroup( "generalsettings" ); |
78 | casesens = cfg.readEntry( "casesens" ).toInt(); | 78 | casesens = cfg.readEntry( "casesens" ).toInt(); |
79 | 79 | ||
80 | QString lastDict = cfg.readEntry( "lastdict" ); | 80 | QString lastDict = cfg.readEntry( "lastdict" ); |
81 | int i = 0, e = 0; | 81 | int i = 0, e = 0; |
82 | 82 | ||
83 | QStringList groupListCfg = cfg.groupList().grep( "Method_" ); | 83 | QStringList groupListCfg = cfg.groupList().grep( "Method_" ); |
84 | query_co->clear(); | 84 | query_co->clear(); |
85 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) | 85 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) |
86 | { | 86 | { |
87 | QString name; | 87 | QString name; |
88 | cfg.setGroup( *it ); | 88 | cfg.setGroup( *it ); |
@@ -114,14 +114,14 @@ void ODict::loadConfig() | |||
114 | } | 114 | } |
115 | 115 | ||
116 | void ODict::lookupLanguageNames( QString dictname ) | 116 | void ODict::lookupLanguageNames( QString dictname ) |
117 | { | 117 | { |
118 | Config cfg ( "odict" ); | 118 | Config cfg ( "odict" ); |
119 | cfg.setGroup( "Method_"+dictname ); | 119 | cfg.setGroup( "Method_"+dictname ); |
120 | top_name_content = cfg.readEntry( "Lang1" ); | 120 | top_name_content = cfg.readEntry( "Lang1" ); |
121 | bottom_name_content = cfg.readEntry( "Lang2" ); | 121 | bottom_name_content = cfg.readEntry( "Lang2" ); |
122 | } | 122 | } |
123 | 123 | ||
124 | void ODict::saveConfig() | 124 | void ODict::saveConfig() |
125 | { | 125 | { |
126 | Config cfg ( "odict" ); | 126 | Config cfg ( "odict" ); |
127 | cfg.setGroup( "generalsettings" ); | 127 | cfg.setGroup( "generalsettings" ); |
@@ -138,29 +138,29 @@ void ODict::slotStartQuery() | |||
138 | * if the user has not yet defined a dictionary | 138 | * if the user has not yet defined a dictionary |
139 | */ | 139 | */ |
140 | if ( !query_co->currentText() ) | 140 | if ( !query_co->currentText() ) |
141 | { | 141 | { |
142 | switch ( QMessageBox::information( this, tr( "OPIE-Dictionary" ), | 142 | switch ( QMessageBox::information( this, tr( "OPIE-Dictionary" ), |
143 | tr( "No dictionary defined" ), | 143 | tr( "No dictionary defined" ), |
144 | tr( "&Define one" ), | 144 | tr( "&Define one" ), |
145 | tr( "&Cancel" ), | 145 | tr( "&Cancel" ), |
146 | 0, // Define a dict | 146 | 0, // Define a dict |
147 | 1 ) ) // Cancel choosen | 147 | 1 ) ) // Cancel choosen |
148 | { | 148 | { |
149 | case 0: | 149 | case 0: |
150 | slotSettings(); | 150 | slotSettings(); |
151 | break; | 151 | break; |
152 | case 1: // stop here | 152 | case 1: // stop here |
153 | return; | 153 | return; |
154 | } | 154 | } |
155 | } | 155 | } |
156 | 156 | ||
157 | /* | 157 | /* |
158 | * ok, the user has defined a dict | 158 | * ok, the user has defined a dict |
159 | */ | 159 | */ |
160 | ding->setCaseSensitive( casesens ); | 160 | ding->setCaseSensitive( casesens ); |
161 | 161 | ||
162 | BroswerContent test = ding->setText( querystring ); | 162 | BroswerContent test = ding->setText( querystring ); |
163 | 163 | ||
164 | browser_top->setText( test.top ); | 164 | browser_top->setText( test.top ); |
165 | browser_bottom->setText( test.bottom ); | 165 | browser_bottom->setText( test.bottom ); |
166 | } | 166 | } |
@@ -186,35 +186,35 @@ void ODict::slotSetParameter( int count ) | |||
186 | saveConfig(); | 186 | saveConfig(); |
187 | } | 187 | } |
188 | 188 | ||
189 | void ODict::slotMethodChanged( const QString& methodnumber ) | 189 | void ODict::slotMethodChanged( const QString& methodnumber ) |
190 | { | 190 | { |
191 | activated_name = methodnumber; | 191 | activated_name = methodnumber; |
192 | 192 | ||
193 | if ( activated_name != ding->loadedDict() ) | 193 | if ( activated_name != ding->loadedDict() ) |
194 | { | 194 | { |
195 | ding->loadDict(activated_name); | 195 | ding->loadDict(activated_name); |
196 | 196 | ||
197 | lookupLanguageNames( activated_name ); | 197 | lookupLanguageNames( activated_name ); |
198 | top_name->setText( top_name_content ); | 198 | top_name->setText( top_name_content ); |
199 | bottom_name->setText( bottom_name_content ); | 199 | bottom_name->setText( bottom_name_content ); |
200 | } | 200 | } |
201 | } | 201 | } |
202 | 202 | ||
203 | void ODict::setupMenus() | 203 | void ODict::setupMenus() |
204 | { | 204 | { |
205 | menu = new QMenuBar( this ); | 205 | menu = new QMenuBar( this ); |
206 | 206 | ||
207 | settings = new QPopupMenu( menu ); | 207 | settings = new QPopupMenu( menu ); |
208 | setting_a = new QAction(tr( "Configuration" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); | 208 | setting_a = new QAction(tr( "Configuration" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); |
209 | connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); | 209 | connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); |
210 | setting_a->addTo( settings ); | 210 | setting_a->addTo( settings ); |
211 | setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 ); | 211 | setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 ); |
212 | 212 | ||
213 | parameter = new QPopupMenu( menu ); | 213 | parameter = new QPopupMenu( menu ); |
214 | connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); | 214 | connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) ); |
215 | parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 ); | 215 | parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 ); |
216 | parameter->insertSeparator(); | 216 | parameter->insertSeparator(); |
217 | 217 | ||
218 | menu->insertItem( tr( "Settings" ) , settings ); | 218 | menu->insertItem( tr( "Settings" ) , settings ); |
219 | menu->insertItem( tr( "Parameter" ) , parameter ); | 219 | menu->insertItem( tr( "Parameter" ) , parameter ); |
220 | } | 220 | } |