summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp27
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
@@ -5,24 +5,25 @@
5 copyright : (C) 2000 -2004 by llornkcor 5 copyright : (C) 2000 -2004 by llornkcor
6 email : ljp@llornkcor.com 6 email : ljp@llornkcor.com
7***************************************************************************/ 7***************************************************************************/
8/*************************************************************************** 8/***************************************************************************
9 * This program is free software; you can redistribute it and/or modify * 9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by * 10 * it under the terms of the GNU General Public License as published by *
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>
23#include <qpe/resource.h> 24#include <qpe/resource.h>
24#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
25 26
26/* QT */ 27/* QT */
27#include <qfontinfo.h> 28#include <qfontinfo.h>
28#include <qtoolbutton.h> 29#include <qtoolbutton.h>
@@ -52,25 +53,25 @@ void Gutenbrowser::initConfig() {
52 msg = "chmod 755 " + local_library; 53 msg = "chmod 755 " + local_library;
53 system(msg); 54 system(msg);
54// QDir pixdir(local_library+"pix"); 55// QDir pixdir(local_library+"pix");
55// if ( !pixdir.exists()) { 56// if ( !pixdir.exists()) {
56// pixdir.mkdir(local_library+"pix", TRUE); 57// pixdir.mkdir(local_library+"pix", TRUE);
57// QString msg; 58// QString msg;
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" );
71//useWordWrap_CheckBox 72//useWordWrap_CheckBox
72 useIcons=TRUE; 73 useIcons=TRUE;
73#else 74#else
74 75
75 config.setGroup( "General" ); 76 config.setGroup( "General" );
76 QString s_Split=config.readEntry("Splitter", "TRUE" ); 77 QString s_Split=config.readEntry("Splitter", "TRUE" );
@@ -142,39 +143,39 @@ void Gutenbrowser::initConfig() {
142 ftp_base_dir= config.readEntry("base", "/pub/gutenberg"); 143 ftp_base_dir= config.readEntry("base", "/pub/gutenberg");
143 144
144 //bool ok2; 145 //bool ok2;
145 QString temp; 146 QString temp;
146 QString copying; 147 QString copying;
147 copying=""; 148 copying="";
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; 155qDebug("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
166void Gutenbrowser::initMenuBar() 167void 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()) );
175// fileMenu->insertItem("Download FTPSite", this, SLOT( downloadFtpList()) ); 176// fileMenu->insertItem("Download FTPSite", this, SLOT( downloadFtpList()) );
176 fileMenu->insertItem( Resource::loadPixmap("home"), 177 fileMenu->insertItem( Resource::loadPixmap("home"),
177 "Download Library Index", this, SLOT( downloadLibIndex()) ); 178 "Download Library Index", this, SLOT( downloadLibIndex()) );
178 fileMenu->insertItem( Resource::loadPixmap("quit"), 179 fileMenu->insertItem( Resource::loadPixmap("quit"),
179 "Quit Gutenbrowser...", this, SLOT( ByeBye()) ); 180 "Quit Gutenbrowser...", this, SLOT( ByeBye()) );
180 // menuBar entry editMenu 181 // menuBar entry editMenu
@@ -202,29 +203,28 @@ void Gutenbrowser::initMenuBar()
202 menubar->insertItem("File", fileMenu); 203 menubar->insertItem("File", fileMenu);
203 menubar->insertItem("Page", editMenu); 204 menubar->insertItem("Page", editMenu);
204 menubar->insertItem("Options", optionsMenu); 205 menubar->insertItem("Options", optionsMenu);
205// menubar->insertItem("More Info", donateMenu); 206// menubar->insertItem("More Info", donateMenu);
206 207
207 menu->addWidget( menubar,0); 208 menu->addWidget( menubar,0);
208 209
209 topLayout->addLayout( menu, 0); 210 topLayout->addLayout( menu, 0);
210} 211}
211 212
212void Gutenbrowser::initButtonBar() 213void 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);
225 225
226 ForwardButton = new QPushButton( this, "ForwardButton" ); 226 ForwardButton = new QPushButton( this, "ForwardButton" );
227 ForwardButton->setFocusPolicy( QWidget::TabFocus ); 227 ForwardButton->setFocusPolicy( QWidget::TabFocus );
228// ForwardButton->setAutoRepeat(TRUE); 228// ForwardButton->setAutoRepeat(TRUE);
229 229
230 SearchButton = new QPushButton( this, "SearchButton" ); 230 SearchButton = new QPushButton( this, "SearchButton" );
@@ -236,97 +236,96 @@ void Gutenbrowser::initButtonBar()
236 lastBmkButton = new MenuButton( this, "lastBmkButton" ); 236 lastBmkButton = new MenuButton( this, "lastBmkButton" );
237 lastBmkButton->setFocusPolicy( QWidget::TabFocus ); 237 lastBmkButton->setFocusPolicy( QWidget::TabFocus );
238 238
239 bookmarksMenu = new QPopupMenu(); 239 bookmarksMenu = new QPopupMenu();
240 bookmarksMenu->insertItem("Last Set", this, SLOT(Bookmark( int) )); 240 bookmarksMenu->insertItem("Last Set", this, SLOT(Bookmark( int) ));
241 241
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);
255 buttons2->addWidget(BackButton, 0, AlignCenter); 254 buttons2->addWidget(BackButton, 0, AlignCenter);
256 buttons2->addWidget(ForwardButton, 0, AlignCenter); 255 buttons2->addWidget(ForwardButton, 0, AlignCenter);
257 buttons2->addWidget(SearchButton, 0, AlignCenter); 256 buttons2->addWidget(SearchButton, 0, AlignCenter);
258 buttons2->addWidget(setBookmarkButton, 0, AlignCenter); 257 buttons2->addWidget(setBookmarkButton, 0, AlignCenter);
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*/
269void Gutenbrowser::initStatusBar() 267void 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
278void Gutenbrowser::initView() 277void 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
308 cfg.setGroup("General"); 306 cfg.setGroup("General");
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);
322 Lview->setReadOnly( true); 320 Lview->setReadOnly( true);
323 edits->addWidget( Lview); 321 edits->addWidget( Lview);
324 edits->addWidget(mainList); 322 edits->addWidget(mainList);
325 323
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}