-rw-r--r-- | noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp index a226258..9473ba9 100644 --- a/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp +++ b/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp | |||
@@ -11,12 +11,13 @@ | |||
11 | * the Free Software Foundation; either version 2 of the License, or * | 11 | * the Free Software Foundation; either version 2 of the License, or * |
12 | * (at your option) any later version. * | 12 | * (at your option) any later version. * |
13 | ***************************************************************************/ | 13 | ***************************************************************************/ |
14 | 14 | ||
15 | //#include "gutenbrowserData.h" | 15 | //#include "gutenbrowserData.h" |
16 | #include "gutenbrowser.h" | 16 | #include "gutenbrowser.h" |
17 | #include "multiline_ex.h" | ||
17 | 18 | ||
18 | /* OPIE */ | 19 | /* OPIE */ |
19 | #include <opie2/odebug.h> | 20 | #include <opie2/odebug.h> |
20 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
21 | #include <qpe/fontdatabase.h> | 22 | #include <qpe/fontdatabase.h> |
22 | #include <qpe/menubutton.h> | 23 | #include <qpe/menubutton.h> |
@@ -58,13 +59,13 @@ void Gutenbrowser::initConfig() { | |||
58 | // msg = "chmod 755 " + local_library+"pix"; | 59 | // msg = "chmod 755 " + local_library+"pix"; |
59 | // system(msg); | 60 | // system(msg); |
60 | // } | 61 | // } |
61 | // #endif | 62 | // #endif |
62 | 63 | ||
63 | } | 64 | } |
64 | // odebug << "init file is " << iniFile << "" << oendl; | 65 | qDebug("init file is " + iniFile );; |
65 | 66 | ||
66 | #ifdef Q_WS_QWS | 67 | #ifdef Q_WS_QWS |
67 | useSplitter=FALSE; | 68 | useSplitter=FALSE; |
68 | Config config("Gutenbrowser"); | 69 | Config config("Gutenbrowser"); |
69 | 70 | ||
70 | config.setGroup( "General" ); | 71 | config.setGroup( "General" ); |
@@ -148,27 +149,27 @@ void Gutenbrowser::initConfig() { | |||
148 | 149 | ||
149 | config.setGroup("General"); | 150 | config.setGroup("General"); |
150 | QString qExit; | 151 | QString qExit; |
151 | qExit=config.readEntry("queryExit","TRUE"); | 152 | qExit=config.readEntry("queryExit","TRUE"); |
152 | if(qExit=="TRUE") { | 153 | if(qExit=="TRUE") { |
153 | b_queryExit=TRUE; | 154 | b_queryExit=TRUE; |
154 | // odebug << "Please query before leaving the library." << oendl; | 155 | qDebug("lease query before leaving the library.");; |
155 | } else { | 156 | } else { |
156 | // odebug << "Please DO NOT query before leaving the library." << oendl; | 157 | qDebug("Please DO NOT query before leaving the library."); |
157 | b_queryExit=FALSE; | 158 | b_queryExit=FALSE; |
158 | } | 159 | } |
159 | // bookmarks | 160 | // bookmarks |
160 | // config.setGroup("Titles"); | 161 | // config.setGroup("Titles"); |
161 | // QString tmpTitle=config.readEntry(file_name,""); | 162 | // QString tmpTitle=config.readEntry(file_name,""); |
162 | 163 | ||
163 | 164 | ||
164 | }// end initConfig() | 165 | }// end initConfig() |
165 | 166 | ||
166 | void Gutenbrowser::initMenuBar() | 167 | void Gutenbrowser::initMenuBar() |
167 | { | 168 | { |
168 | // odebug << "Starting menu init." << oendl; | 169 | qDebug("Starting menu init."); |
169 | // menuBar entry fileMenu | 170 | // menuBar entry fileMenu |
170 | menubar = new QPEMenuBar(this); | 171 | menubar = new QPEMenuBar(this); |
171 | 172 | ||
172 | fileMenu=new QPopupMenu(); | 173 | fileMenu=new QPopupMenu(); |
173 | fileMenu->insertItem(Resource::loadPixmap("gutenbrowser/openbook"), | 174 | fileMenu->insertItem(Resource::loadPixmap("gutenbrowser/openbook"), |
174 | "Open Local Library...", this, SLOT( OpenBtn()) ); | 175 | "Open Local Library...", this, SLOT( OpenBtn()) ); |
@@ -208,17 +209,16 @@ void Gutenbrowser::initMenuBar() | |||
208 | 209 | ||
209 | topLayout->addLayout( menu, 0); | 210 | topLayout->addLayout( menu, 0); |
210 | } | 211 | } |
211 | 212 | ||
212 | void Gutenbrowser::initButtonBar() | 213 | void Gutenbrowser::initButtonBar() |
213 | { | 214 | { |
214 | //odebug << "Starting buttonbar init." << oendl; | 215 | qDebug("Starting buttonbar init."); |
215 | 216 | ||
216 | OpenButton = new QPushButton( this, "OpenButton" ); | 217 | OpenButton = new QPushButton( this, "OpenButton" ); |
217 | OpenButton->setFocusPolicy( QWidget::TabFocus ); | 218 | OpenButton->setFocusPolicy( QWidget::TabFocus ); |
218 | |||
219 | LibraryButton = new QPushButton( this, "LibraryButton" ); | 219 | LibraryButton = new QPushButton( this, "LibraryButton" ); |
220 | LibraryButton->setFocusPolicy( QWidget::TabFocus ); | 220 | LibraryButton->setFocusPolicy( QWidget::TabFocus ); |
221 | 221 | ||
222 | BackButton = new QPushButton( this, "BackButton" ); | 222 | BackButton = new QPushButton( this, "BackButton" ); |
223 | BackButton->setFocusPolicy( QWidget::TabFocus ); | 223 | BackButton->setFocusPolicy( QWidget::TabFocus ); |
224 | BackButton->setAutoRepeat(TRUE); | 224 | BackButton->setAutoRepeat(TRUE); |
@@ -242,13 +242,12 @@ void Gutenbrowser::initButtonBar() | |||
242 | lastBmkButton->setPopup(bookmarksMenu); | 242 | lastBmkButton->setPopup(bookmarksMenu); |
243 | 243 | ||
244 | dictionaryButton = new QPushButton( this, "dictionaryButton" ); | 244 | dictionaryButton = new QPushButton( this, "dictionaryButton" ); |
245 | dictionaryButton->setFocusPolicy( QWidget::TabFocus ); | 245 | dictionaryButton->setFocusPolicy( QWidget::TabFocus ); |
246 | 246 | ||
247 | InfoBar = new QPushButton( this, "Info_Bar" ); | 247 | InfoBar = new QPushButton( this, "Info_Bar" ); |
248 | // odebug << "Infobar" << oendl; | ||
249 | // if(!useSplitter) { | 248 | // if(!useSplitter) { |
250 | 249 | ||
251 | buttonsHidden=FALSE; | 250 | buttonsHidden=FALSE; |
252 | buttons2->setSpacing(2); | 251 | buttons2->setSpacing(2); |
253 | buttons2->addWidget(OpenButton, 0, AlignCenter); | 252 | buttons2->addWidget(OpenButton, 0, AlignCenter); |
254 | buttons2->addWidget(LibraryButton, 0, AlignCenter); | 253 | buttons2->addWidget(LibraryButton, 0, AlignCenter); |
@@ -259,49 +258,48 @@ void Gutenbrowser::initButtonBar() | |||
259 | buttons2->addWidget(lastBmkButton, 0, AlignCenter); | 258 | buttons2->addWidget(lastBmkButton, 0, AlignCenter); |
260 | buttons2->addWidget(dictionaryButton, 0, AlignCenter); | 259 | buttons2->addWidget(dictionaryButton, 0, AlignCenter); |
261 | buttons2->addWidget(InfoBar, 0, AlignCenter); | 260 | buttons2->addWidget(InfoBar, 0, AlignCenter); |
262 | 261 | ||
263 | topLayout->setSpacing(0); | 262 | topLayout->setSpacing(0); |
264 | topLayout->addLayout( buttons2,0); | 263 | topLayout->addLayout( buttons2,0); |
265 | |||
266 | } | 264 | } |
267 | 265 | ||
268 | /* STATUSBAR*/ | 266 | /* STATUSBAR*/ |
269 | void Gutenbrowser::initStatusBar() | 267 | void Gutenbrowser::initStatusBar() |
270 | { | 268 | { |
269 | qDebug("statusbar"); | ||
271 | // #ifndef Q_WS_QWS | 270 | // #ifndef Q_WS_QWS |
272 | 271 | ||
273 | // statusBar = new QStatusBar( this, "Status Bar"); | 272 | // statusBar = new QStatusBar( this, "Status Bar"); |
274 | // statusBar->message(IDS_STATUS_DEFAULT, 2000); | 273 | // statusBar->message(IDS_STATUS_DEFAULT, 2000); |
275 | // #endif | 274 | // #endif |
276 | } | 275 | } |
277 | 276 | ||
278 | void Gutenbrowser::initView() | 277 | void Gutenbrowser::initView() |
279 | { | 278 | { |
280 | // set the main widget here | 279 | // set the main widget here |
281 | // QFont defaultFont( "charter", 10, 50, 0 ); | 280 | // QFont defaultFont( "charter", 10, 50, 0 ); |
282 | Lview = new MultiLine_Ex(this); | 281 | Lview = new MultiLine_Ex(this); |
283 | |||
284 | Config cfg("Gutenbrowser"); | 282 | Config cfg("Gutenbrowser"); |
285 | cfg.setGroup("Font"); | 283 | cfg.setGroup("Font"); |
286 | 284 | ||
287 | FontDatabase fdb; | 285 | FontDatabase fdb; |
288 | QFont defaultFont=Lview->font(); | 286 | QFont defaultFont = Lview->font(); |
289 | QFontInfo fontInfo(defaultFont); | 287 | QFontInfo fontInfo(defaultFont); |
290 | 288 | ||
291 | QString family = cfg.readEntry("Family", fontInfo.family()); | 289 | QString family = cfg.readEntry("Family", fontInfo.family()); |
292 | QString style = cfg.readEntry("Style", fdb.styleString(defaultFont)); | 290 | QString style = cfg.readEntry("Style", fdb.styleString(defaultFont)); |
293 | int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10); | 291 | int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10); |
294 | QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) ); | 292 | QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) ); |
295 | 293 | ||
296 | defaultFont = fdb.font(family,style,i_size,charSet); | 294 | defaultFont = fdb.font(family,style,i_size,charSet); |
297 | 295 | ||
298 | QString italic=cfg.readEntry("Italic","FALSE"); | 296 | QString italic = cfg.readEntry("Italic","FALSE"); |
299 | if(italic=="TRUE") { | 297 | if(italic=="TRUE") { |
300 | odebug << "Set Italic font" << oendl; | 298 | qDebug("Set Italic font");; |
301 | defaultFont = fdb.font(family,"Regular",i_size,charSet); //workaround | 299 | defaultFont = fdb.font( family, "Regular", i_size,charSet); //workaround |
302 | defaultFont.setItalic(TRUE); | 300 | defaultFont.setItalic(TRUE); |
303 | } | 301 | } |
304 | 302 | ||
305 | Lview->setFont( defaultFont); | 303 | Lview->setFont( defaultFont); |
306 | update(); | 304 | update(); |
307 | 305 | ||
@@ -309,13 +307,13 @@ void Gutenbrowser::initView() | |||
309 | 307 | ||
310 | if( cfg.readBoolEntry("WordWrap", 1)) { | 308 | if( cfg.readBoolEntry("WordWrap", 1)) { |
311 | Lview->setWordWrap(QMultiLineEdit::WidgetWidth); | 309 | Lview->setWordWrap(QMultiLineEdit::WidgetWidth); |
312 | useWrap=true; | 310 | useWrap=true; |
313 | } else { | 311 | } else { |
314 | Lview->setWordWrap(QMultiLineEdit::NoWrap); | 312 | Lview->setWordWrap(QMultiLineEdit::NoWrap); |
315 | useWrap=false; | 313 | useWrap = false; |
316 | } | 314 | } |
317 | mainList = new QListBox(this,"mainlist"); | 315 | mainList = new QListBox(this,"mainlist"); |
318 | 316 | ||
319 | // QPEApplication::setStylusOperation( mainList->viewport(),QPEApplication::RightOnHold); | 317 | // QPEApplication::setStylusOperation( mainList->viewport(),QPEApplication::RightOnHold); |
320 | // mainList->showMaximized(); | 318 | // mainList->showMaximized(); |
321 | // mainList->setGeometry(2,30,230,160); | 319 | // mainList->setGeometry(2,30,230,160); |
@@ -326,7 +324,8 @@ void Gutenbrowser::initView() | |||
326 | if(!showMainList) { | 324 | if(!showMainList) { |
327 | Lview->setText( "\nThis is gutenbrowser for the Sharp Zaurus.\nMake your self at home, sit back, relax and read something great. "); | 325 | Lview->setText( "\nThis is gutenbrowser for the Sharp Zaurus.\nMake your self at home, sit back, relax and read something great. "); |
328 | } else | 326 | } else |
329 | Lview->hide(); | 327 | Lview->hide(); |
330 | 328 | ||
331 | topLayout->addLayout( edits, 0); | 329 | topLayout->addLayout( edits, 0); |
330 | qDebug("end initView"); | ||
332 | } | 331 | } |