-rw-r--r-- | noncore/apps/odict/odict.cpp | 53 |
1 files changed, 41 insertions, 12 deletions
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp index 6f176f9..549c40a 100644 --- a/noncore/apps/odict/odict.cpp +++ b/noncore/apps/odict/odict.cpp | |||
@@ -36,28 +36,31 @@ | |||
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 | activated_name = QString::null; |
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 | QHBox *hbox = new QHBox( vbox ); | 49 | QHBox *hbox = new QHBox( vbox ); |
49 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show(); | 50 | QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show(); |
50 | query_le = new QLineEdit( hbox ); | 51 | query_le = new QLineEdit( hbox ); |
51 | query_co = new QComboBox( hbox ); | 52 | query_co = new QComboBox( hbox ); |
52 | connect( query_co , SIGNAL( activated(int) ), this, SLOT( slotMethodChanged(int) ) ); | 53 | connect( query_co , SIGNAL( activated(int) ), this, SLOT( slotMethodChanged(int) ) ); |
53 | ok_button = new QPushButton( tr( "&Ok" ), hbox ); | 54 | ok_button = new QPushButton( tr( "&Ok" ), hbox ); |
54 | connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); | 55 | connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) ); |
55 | browser_top = new QTextBrowser( vbox ); | 56 | browser_top = new QTextBrowser( vbox ); |
56 | browser_bottom = new QTextBrowser( vbox ); | 57 | browser_bottom = new QTextBrowser( vbox ); |
57 | 58 | ||
59 | ding = new DingWidget(); | ||
60 | |||
58 | loadConfig(); | 61 | loadConfig(); |
59 | setCentralWidget( vbox ); | 62 | setCentralWidget( vbox ); |
60 | } | 63 | } |
61 | 64 | ||
62 | void ODict::loadConfig() | 65 | void ODict::loadConfig() |
63 | { | 66 | { |
@@ -72,12 +75,13 @@ void ODict::loadConfig() | |||
72 | query_co->clear(); | 75 | query_co->clear(); |
73 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) | 76 | for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) |
74 | { | 77 | { |
75 | cfg.setGroup( *it ); | 78 | cfg.setGroup( *it ); |
76 | query_co->insertItem( cfg.readEntry( "Name" ) ); | 79 | query_co->insertItem( cfg.readEntry( "Name" ) ); |
77 | } | 80 | } |
81 | slotMethodChanged(1 ); //FIXME: this line should not contain a integer | ||
78 | } | 82 | } |
79 | 83 | ||
80 | 84 | ||
81 | void ODict::saveConfig() | 85 | void ODict::saveConfig() |
82 | { | 86 | { |
83 | Config cfg ( "odict" ); | 87 | Config cfg ( "odict" ); |
@@ -87,28 +91,53 @@ void ODict::saveConfig() | |||
87 | cfg.writeEntry( "regexp" , regexp ); | 91 | cfg.writeEntry( "regexp" , regexp ); |
88 | cfg.writeEntry( "completewords" , completewords ); | 92 | cfg.writeEntry( "completewords" , completewords ); |
89 | } | 93 | } |
90 | 94 | ||
91 | void ODict::slotDisplayAbout() | 95 | void ODict::slotDisplayAbout() |
92 | { | 96 | { |
93 | QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20030104" ) ); | 97 | QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20030108" ) ); |
94 | } | 98 | } |
95 | 99 | ||
96 | void ODict::slotStartQuery() | 100 | void ODict::slotStartQuery() |
97 | { | 101 | { |
98 | QString querystring = query_le->text(); | 102 | QString querystring = query_le->text(); |
99 | qDebug("opening dict >%s< for >%s<", activated_name.latin1(),querystring.latin1()); | 103 | //X qDebug("opening dict >%s< for >%s<", activated_name.latin1(),querystring.latin1()); |
100 | if (querystring.isEmpty()){ | 104 | //X if (querystring.isEmpty()){ |
101 | qWarning("empty querystring"); | 105 | //X qWarning("empty querystring"); |
102 | return; | 106 | //X return; |
107 | //X } | ||
108 | //X if (!activated_name || activated_name.isEmpty()) | ||
109 | //X QMessageBox::warning(this,tr("No Dictionary"),tr("Please choose a dictonary") ); | ||
110 | //X else | ||
111 | //X { | ||
112 | |||
113 | ding->setCaseSensitive( casesens ); | ||
114 | ding->setCompleteWord( completewords ); | ||
115 | ding->setDict( activated_name ); | ||
116 | |||
117 | qDebug( " activated_name ist :" ); | ||
118 | qDebug( activated_name ); | ||
119 | |||
120 | qDebug( " loadedDict() ist :" ); | ||
121 | qDebug( ding->loadedDict() ); | ||
122 | if ( activated_name != ding->loadedDict() ) | ||
123 | { | ||
124 | qDebug( "ComboBox geändert" ); | ||
125 | ding->loadDict(activated_name); | ||
103 | } | 126 | } |
104 | if (!activated_name || activated_name.isEmpty()) | 127 | else qDebug( "ComboBox war GLEICH" ); |
105 | QMessageBox::warning(this,tr("No Dictionary"),tr("Please choose a dictonary") ); | 128 | |
106 | else | 129 | BroswerContent test = ding->setText( querystring ); |
107 | DingWidget *ding = new DingWidget( querystring , browser_top, browser_bottom, activated_name ); | 130 | |
108 | ding->setText(); | 131 | browser_top->setText( test.top ); |
132 | browser_bottom->setText( test.bottom ); | ||
133 | |||
134 | qDebug( "Text sollte gesetzt sein..." ); | ||
135 | |||
136 | //X } | ||
137 | |||
109 | } | 138 | } |
110 | 139 | ||
111 | 140 | ||
112 | void ODict::slotSetErrorcount( int count ) | 141 | void ODict::slotSetErrorcount( int count ) |
113 | { | 142 | { |
114 | errorTol = count; | 143 | errorTol = count; |
@@ -149,13 +178,13 @@ void ODict::slotSetParameter( int count ) | |||
149 | else | 178 | else |
150 | regexp = true; | 179 | regexp = true; |
151 | } | 180 | } |
152 | else qWarning( "ERROR" ); | 181 | else qWarning( "ERROR" ); |
153 | } | 182 | } |
154 | 183 | ||
155 | void ODict::slotMethodChanged( int methodnumber ) | 184 | void ODict::slotMethodChanged( int /*methodnumber*/ ) |
156 | { | 185 | { |
157 | activated_name = query_co->currentText(); | 186 | activated_name = query_co->currentText(); |
158 | } | 187 | } |
159 | 188 | ||
160 | void ODict::setupMenus() | 189 | void ODict::setupMenus() |
161 | { | 190 | { |