summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp
index d384c09..ae1f69c 100644
--- a/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp
+++ b/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp
@@ -1,340 +1,343 @@
1/*************************************************************************** 1/***************************************************************************
2 gutenbrowser.cpp - description 2 gutenbrowser.cpp - description
3 ------------------- 3 -------------------
4 begin : Mon Jul 24 22:33:12 MDT 2000 4 begin : Mon Jul 24 22:33:12 MDT 2000
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#include "multiline_ex.h"
18 18
19/* OPIE */ 19/* OPIE */
20#include <opie2/odebug.h> 20#include <opie2/odebug.h>
21#include <opie2/oresource.h> 21#include <opie2/oresource.h>
22 22
23#include <qpe/config.h> 23#include <qpe/config.h>
24#include <qpe/fontdatabase.h> 24#include <qpe/fontdatabase.h>
25#include <qpe/menubutton.h> 25#include <qpe/menubutton.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28 28
29/* QT */ 29/* QT */
30#include <qfontinfo.h> 30#include <qfontinfo.h>
31#include <qtoolbutton.h> 31#include <qtoolbutton.h>
32 32
33void Gutenbrowser::initSlots() { 33void Gutenbrowser::initSlots() {
34 34
35 connect(LibraryButton,SIGNAL(released()),SLOT(LibraryBtn())); 35 connect(LibraryButton,SIGNAL(released()),SLOT(LibraryBtn()));
36 connect(OpenButton,SIGNAL(released()),SLOT(OpenBtn())); 36 connect(OpenButton,SIGNAL(released()),SLOT(OpenBtn()));
37 connect(SearchButton,SIGNAL(released()),SLOT(SearchBtn())); 37 connect(SearchButton,SIGNAL(released()),SLOT(SearchBtn()));
38 connect(ForwardButton,SIGNAL(clicked()),SLOT(ForwardBtn())); 38 connect(ForwardButton,SIGNAL(clicked()),SLOT(ForwardBtn()));
39 connect(BackButton,SIGNAL(clicked()),SLOT(BackBtn())); 39 connect(BackButton,SIGNAL(clicked()),SLOT(BackBtn()));
40 connect(setBookmarkButton,SIGNAL(released()),SLOT(setBookmark())); 40 connect(setBookmarkButton,SIGNAL(released()),SLOT(setBookmark()));
41 connect(dictionaryButton,SIGNAL(released()),SLOT(LookupBtn())); 41 connect(dictionaryButton,SIGNAL(released()),SLOT(LookupBtn()));
42 connect(InfoBar,SIGNAL(clicked()),SLOT(InfoBarClick())); 42 connect(InfoBar,SIGNAL(clicked()),SLOT(InfoBarClick()));
43 connect(qApp,SIGNAL(aboutToQuit()),SLOT(cleanUp())); 43 connect(qApp,SIGNAL(aboutToQuit()),SLOT(cleanUp()));
44 connect(mainList,SIGNAL(clicked(QListBoxItem *)),SLOT(listClickedSlot(QListBoxItem *))); 44 connect(mainList,SIGNAL(clicked(QListBoxItem *)),SLOT(listClickedSlot(QListBoxItem *)));
45 connect(bookmarksMenu,SIGNAL(activated(int)),SLOT(Bookmark(int))); 45 connect(bookmarksMenu,SIGNAL(activated(int)),SLOT(Bookmark(int)));
46} 46}
47 47
48void Gutenbrowser::initConfig() { 48void Gutenbrowser::initConfig() {
49//odebug << "Starting configuration." << oendl; 49//odebug << "Starting configuration." << oendl;
50 QDir library(local_library); 50 QDir library(local_library);
51 if ( !library.exists()) { 51 if ( !library.exists()) {
52 library.mkdir(local_library, TRUE); 52 library.mkdir(local_library, TRUE);
53 QString msg; 53 QString msg;
54// #ifndef Q_WS_WIN 54// #ifndef Q_WS_WIN
55 msg = "chmod 755 " + local_library; 55 msg = "chmod 755 " + local_library;
56 system(msg); 56 system(msg);
57// QDir pixdir(local_library+"pix"); 57// QDir pixdir(local_library+"pix");
58// if ( !pixdir.exists()) { 58// if ( !pixdir.exists()) {
59// pixdir.mkdir(local_library+"pix", TRUE); 59// pixdir.mkdir(local_library+"pix", TRUE);
60// QString msg; 60// QString msg;
61// msg = "chmod 755 " + local_library+"pix"; 61// msg = "chmod 755 " + local_library+"pix";
62// system(msg); 62// system(msg);
63// } 63// }
64// #endif 64// #endif
65 65
66 } 66 }
67 qDebug("init file is " + iniFile );; 67 qDebug("init file is " + iniFile );;
68 68
69#ifdef Q_WS_QWS 69#ifdef Q_WS_QWS
70 useSplitter=FALSE; 70 useSplitter=FALSE;
71 Config config("Gutenbrowser"); 71 Config config("Gutenbrowser");
72 72
73 config.setGroup( "General" ); 73 config.setGroup( "General" );
74//useWordWrap_CheckBox 74//useWordWrap_CheckBox
75 useIcons=TRUE; 75 useIcons=TRUE;
76#else 76#else
77 77
78 config.setGroup( "General" ); 78 config.setGroup( "General" );
79 QString s_Split=config.readEntry("Splitter", "TRUE" ); 79 QString s_Split=config.readEntry("Splitter", "TRUE" );
80 QWidget *d = QApplication::desktop(); 80 QWidget *d = QApplication::desktop();
81 int width=d->width(); 81 int width=d->width();
82 int height=d->height(); 82 int height=d->height();
83 int w=0, h=0; 83 int w=0, h=0;
84 QString str, str2; 84 QString str, str2;
85 85
86 this->setMaximumWidth(width); 86 this->setMaximumWidth(width);
87 87
88 if(s_Split=="TRUE") 88 if(s_Split=="TRUE")
89 useSplitter=TRUE; 89 useSplitter=TRUE;
90 else 90 else
91 useSplitter=FALSE; 91 useSplitter=FALSE;
92 92
93 config.setGroup( "Geometry" ); 93 config.setGroup( "Geometry" );
94 if(width < 1030) { 94 if(width < 1030) {
95 str = config.readEntry("Frame", "700,500"); 95 str = config.readEntry("Frame", "700,500");
96 if( !str.isEmpty() && str.find(',')>=0) { 96 if( !str.isEmpty() && str.find(',')>=0) {
97 sscanf(str,"%d,%d",&w,&h); 97 sscanf(str,"%d,%d",&w,&h);
98 resize(w,h); 98 resize(w,h);
99 str2.sprintf("%d,%d", (width-w)/2,(height-h)/2); 99 str2.sprintf("%d,%d", (width-w)/2,(height-h)/2);
100 str = config.readEntry( "Position", str2); 100 str = config.readEntry( "Position", str2);
101 } else { 101 } else {
102 resize( 740,510 ); 102 resize( 740,510 );
103 str2.sprintf("%d,%d", (width-w)/2,(height-h)/2); 103 str2.sprintf("%d,%d", (width-w)/2,(height-h)/2);
104 str = config.readEntry( "Position",str2); 104 str = config.readEntry( "Position",str2);
105 } 105 }
106 } else {// desktop is high res 106 } else {// desktop is high res
107 str = config.readEntry("Frame", "990,640"); 107 str = config.readEntry("Frame", "990,640");
108 if( !str.isEmpty() && str.find(',')>=0) { 108 if( !str.isEmpty() && str.find(',')>=0) {
109 sscanf(str,"%d,%d",&w,&h); 109 sscanf(str,"%d,%d",&w,&h);
110 resize(w,h); 110 resize(w,h);
111 str2.sprintf("%d,%d", (width-w)/2,(height-h)/2); 111 str2.sprintf("%d,%d", (width-w)/2,(height-h)/2);
112 str = config.readEntry( "Position", str2); 112 str = config.readEntry( "Position", str2);
113 } else { 113 } else {
114 resize( 990,640 ); 114 resize( 990,640 );
115 str2.sprintf("%d,%d", (width-w)/2,(height-h)/2); 115 str2.sprintf("%d,%d", (width-w)/2,(height-h)/2);
116 str = config.readEntry( "Position", str2); 116 str = config.readEntry( "Position", str2);
117 } 117 }
118 } 118 }
119 int posX, posY; 119 int posX, posY;
120 bool ok; 120 bool ok;
121 QString goober; 121 QString goober;
122 goober=str.left( str.find(",", 0, TRUE) ); 122 goober=str.left( str.find(",", 0, TRUE) );
123 posX=goober.toInt( &ok, 10); 123 posX=goober.toInt( &ok, 10);
124 goober=str.right( str.findRev(",", -1, TRUE) ); 124 goober=str.right( str.findRev(",", -1, TRUE) );
125 posY= goober.toInt( &ok, 10); 125 posY= goober.toInt( &ok, 10);
126// move( posX, posY); 126// move( posX, posY);
127 str = config.readEntry("Icons", "TRUE"); 127 str = config.readEntry("Icons", "TRUE");
128 if(str == "TRUE") 128 if(str == "TRUE")
129 useIcons=TRUE; 129 useIcons=TRUE;
130 else 130 else
131 useIcons=FALSE; 131 useIcons=FALSE;
132#endif 132#endif
133// #if defined(_WS_WIN_) 133// #if defined(_WS_WIN_)
134// move( posX-4, posY-20); 134// move( posX-4, posY-20);
135// #endif 135// #endif
136 136
137 config.setGroup( "Browser" ); 137 config.setGroup( "Browser" );
138 brow = config.readEntry( "Preferred", "Opera"); 138 brow = config.readEntry( "Preferred", "Opera");
139 config.setGroup( "FTPsite" ); // ftp server config 139 config.setGroup( "FTPsite" ); // ftp server config
140 ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org"); 140 ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org");
141// ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); 141// ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) );
142 ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); 142 ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) );
143 ftp_host=ftp_host.stripWhiteSpace(); 143 ftp_host=ftp_host.stripWhiteSpace();
144 144
145 ftp_base_dir= config.readEntry("base", "/pub/gutenberg"); 145 ftp_base_dir= config.readEntry("base", "/pub/gutenberg");
146 146
147 //bool ok2; 147 //bool ok2;
148 QString temp; 148 QString temp;
149 QString copying; 149 QString copying;
150 copying=""; 150 copying="";
151 151
152 config.setGroup("General"); 152 config.setGroup("General");
153 QString qExit; 153 QString qExit;
154 qExit=config.readEntry("queryExit","TRUE"); 154 qExit=config.readEntry("queryExit","TRUE");
155 if(qExit=="TRUE") { 155 if(qExit=="TRUE") {
156 b_queryExit=TRUE; 156 b_queryExit=TRUE;
157qDebug("lease query before leaving the library.");; 157qDebug("lease query before leaving the library.");;
158 } else { 158 } else {
159 qDebug("Please DO NOT query before leaving the library."); 159 qDebug("Please DO NOT query before leaving the library.");
160 b_queryExit=FALSE; 160 b_queryExit=FALSE;
161 } 161 }
162// bookmarks 162// bookmarks
163// config.setGroup("Titles"); 163// config.setGroup("Titles");
164// QString tmpTitle=config.readEntry(file_name,""); 164// QString tmpTitle=config.readEntry(file_name,"");
165 165
166 166
167}// end initConfig() 167}// end initConfig()
168 168
169#define SCALED Opie::Core::OResource::SmallIcon
170
169void Gutenbrowser::initMenuBar() 171void Gutenbrowser::initMenuBar()
170{ 172{
171 qDebug("Starting menu init."); 173 qDebug("Starting menu init.");
172 // menuBar entry fileMenu 174 // menuBar entry fileMenu
173 menubar = new QPEMenuBar(this); 175 menubar = new QPEMenuBar(this);
174 176
175 fileMenu=new QPopupMenu(); 177 fileMenu=new QPopupMenu();
176 fileMenu->insertItem( Opie::Core::OResource::loadPixmap("gutenbrowser/openbook", Opie::Core::OResource::SmallIcon ), 178 fileMenu->insertItem( Opie::Core::OResource::loadPixmap("gutenbrowser/openbook", SCALED ),
177 "Open Local Library...", this, SLOT( OpenBtn()) ); 179 "Open Local Library...", this, SLOT( OpenBtn()) );
178// fileMenu->insertItem("Download FTPSite", this, SLOT( downloadFtpList()) ); 180// fileMenu->insertItem("Download FTPSite", this, SLOT( downloadFtpList()) );
179 fileMenu->insertItem( Opie::Core::OResource::loadPixmap("home", Opie::Core::OResource::SmallIcon ), 181 fileMenu->insertItem( Opie::Core::OResource::loadPixmap("home", SCALED ),
180 "Download Library Index", this, SLOT( downloadLibIndex()) ); 182 "Download Library Index", this, SLOT( downloadLibIndex()) );
181 fileMenu->insertItem( Opie::Core::OResource::loadPixmap("quit", Opie::Core::OResource::SmallIcon ), 183 fileMenu->insertItem( Opie::Core::OResource::loadPixmap("quit",SCALED),
182 "Quit Gutenbrowser...", this, SLOT( ByeBye()) ); 184 "Quit Gutenbrowser...", this, SLOT( ByeBye()) );
183 // menuBar entry editMenu 185 // menuBar entry editMenu
184 186
185 editMenu=new QPopupMenu(); 187 editMenu=new QPopupMenu();
186 188
187 editMenu->insertItem( Opie::Core::OResource::loadPixmap("up", Opie::Core::OResource::SmallIcon ), "Top", 189 editMenu->insertItem( Opie::Core::OResource::loadPixmap("up", SCALED ), "Top",
188 this, SLOT(TopBtn()) ); 190 this, SLOT(TopBtn()) );
189 editMenu->insertItem( Opie::Core::OResource::loadPixmap("back", Opie::Core::OResource::SmallIcon ), "Beginning", 191 editMenu->insertItem( Opie::Core::OResource::loadPixmap("back",SCALED ), "Beginning",
190 this, SLOT(doBeginBtn()) ); 192 this, SLOT(doBeginBtn()) );
191 editMenu->insertItem( Opie::Core::OResource::loadPixmap("gutenbrowser/search", Opie::Core::OResource::SmallIcon ), "Search", 193 editMenu->insertItem( Opie::Core::OResource::loadPixmap("gutenbrowser/search",SCALED ), "Search",
192 this, SLOT(SearchBtn()) ); 194 this, SLOT(SearchBtn()) );
193 195
194 editMenu->insertItem("Clear", this, SLOT(ClearEdit()) ); 196 editMenu->insertItem("Clear", this, SLOT(ClearEdit()) );
195 197
196 optionsMenu= new QPopupMenu(); 198 optionsMenu= new QPopupMenu();
197 optionsMenu->insertItem( Opie::Core::OResource::loadPixmap("gutenbrowser/configure", Opie::Core::OResource::SmallIcon ), 199 optionsMenu->insertItem( Opie::Core::OResource::loadPixmap("gutenbrowser/configure",SCALED ),
198 "Configure", this, SLOT(doOptions()) ); 200 "Configure", this, SLOT(doOptions()) );
199 201
200 donateMenu = new QPopupMenu(); 202 donateMenu = new QPopupMenu();
201// donateMenu->insertItem("Gutenberg", this, SLOT(donateGutenberg()) ); 203// donateMenu->insertItem("Gutenberg", this, SLOT(donateGutenberg()) );
202 donateMenu->insertItem( Opie::Core::OResource::loadPixmap("gutenbrowser/gutenbrowser_sm", Opie::Core::OResource::SmallIcon ), 204 donateMenu->insertItem( Opie::Core::OResource::loadPixmap("gutenbrowser/gutenbrowser_sm", SCALED ),
203 "Gutenbrowser Developer", this, SLOT(infoGutenbrowser()) ); 205 "Gutenbrowser Developer", this, SLOT(infoGutenbrowser()) );
204 206
205 menubar->insertItem("File", fileMenu); 207 menubar->insertItem("File", fileMenu);
206 menubar->insertItem("Page", editMenu); 208 menubar->insertItem("Page", editMenu);
207 menubar->insertItem("Options", optionsMenu); 209 menubar->insertItem("Options", optionsMenu);
208// menubar->insertItem("More Info", donateMenu); 210// menubar->insertItem("More Info", donateMenu);
209 211
210 menu->addWidget( menubar,0); 212 menu->addWidget( menubar,0);
211 213
212 topLayout->addLayout( menu, 0); 214 topLayout->addLayout( menu, 0);
213} 215}
214 216
215void Gutenbrowser::initButtonBar() 217void Gutenbrowser::initButtonBar()
216{ 218{
217 qDebug("Starting buttonbar init."); 219 //qDebug("Starting buttonbar init.");
218 220
219 OpenButton = new QPushButton( this, "OpenButton" ); 221 OpenButton = new QPushButton( this, "OpenButton" );
220 OpenButton->setFocusPolicy( QWidget::TabFocus ); 222 OpenButton->setFocusPolicy( QWidget::TabFocus );
221 LibraryButton = new QPushButton( this, "LibraryButton" ); 223 LibraryButton = new QPushButton( this, "LibraryButton" );
222 LibraryButton->setFocusPolicy( QWidget::TabFocus ); 224 LibraryButton->setFocusPolicy( QWidget::TabFocus );
223 225
224 BackButton = new QPushButton( this, "BackButton" ); 226 BackButton = new QPushButton( this, "BackButton" );
225 BackButton->setFocusPolicy( QWidget::TabFocus ); 227 BackButton->setFocusPolicy( QWidget::TabFocus );
226 BackButton->setAutoRepeat(TRUE); 228 BackButton->setAutoRepeat(TRUE);
227 229
228 ForwardButton = new QPushButton( this, "ForwardButton" ); 230 ForwardButton = new QPushButton( this, "ForwardButton" );
229 ForwardButton->setFocusPolicy( QWidget::TabFocus ); 231 ForwardButton->setFocusPolicy( QWidget::TabFocus );
230// ForwardButton->setAutoRepeat(TRUE); 232// ForwardButton->setAutoRepeat(TRUE);
231 233
232 SearchButton = new QPushButton( this, "SearchButton" ); 234 SearchButton = new QPushButton( this, "SearchButton" );
233 SearchButton->setFocusPolicy( QWidget::TabFocus ); 235 SearchButton->setFocusPolicy( QWidget::TabFocus );
234 236
235 setBookmarkButton = new QPushButton( this, "setBookmark" ); 237 setBookmarkButton = new QPushButton( this, "setBookmark" );
236 setBookmarkButton->setFocusPolicy( QWidget::TabFocus ); 238 setBookmarkButton->setFocusPolicy( QWidget::TabFocus );
237 239
238 lastBmkButton = new MenuButton( this, "lastBmkButton" ); 240 lastBmkButton = new MenuButton( this, "lastBmkButton" );
239 lastBmkButton->setFocusPolicy( QWidget::TabFocus ); 241 lastBmkButton->setFocusPolicy( QWidget::TabFocus );
240 242
241 bookmarksMenu = new QPopupMenu(); 243 bookmarksMenu = new QPopupMenu();
242 bookmarksMenu->insertItem("Last Set", this, SLOT(Bookmark( int) )); 244 bookmarksMenu->insertItem("Last Set", this, SLOT(Bookmark( int) ));
243 245
244 lastBmkButton->setPopup(bookmarksMenu); 246 lastBmkButton->setPopup(bookmarksMenu);
245 247
246 dictionaryButton = new QPushButton( this, "dictionaryButton" ); 248 dictionaryButton = new QPushButton( this, "dictionaryButton" );
247 dictionaryButton->setFocusPolicy( QWidget::TabFocus ); 249 dictionaryButton->setFocusPolicy( QWidget::TabFocus );
248 250
249 InfoBar = new QPushButton( this, "Info_Bar" ); 251 InfoBar = new QPushButton( this, "Info_Bar" );
250// if(!useSplitter) { 252// if(!useSplitter) {
251 253
252 buttonsHidden=FALSE; 254 buttonsHidden=false;
253 buttons2->setSpacing(2); 255
254 buttons2->addWidget(OpenButton, 0, AlignCenter); 256 buttons2->addWidget(OpenButton, 0, AlignCenter);
255 buttons2->addWidget(LibraryButton, 0, AlignCenter); 257 buttons2->addWidget(LibraryButton, 0, AlignCenter);
256 buttons2->addWidget(BackButton, 0, AlignCenter); 258 buttons2->addWidget(BackButton, 0, AlignCenter);
257 buttons2->addWidget(ForwardButton, 0, AlignCenter); 259 buttons2->addWidget(ForwardButton, 0, AlignCenter);
258 buttons2->addWidget(SearchButton, 0, AlignCenter); 260 buttons2->addWidget(SearchButton, 0, AlignCenter);
259 buttons2->addWidget(setBookmarkButton, 0, AlignCenter); 261 buttons2->addWidget(setBookmarkButton, 0, AlignCenter);
260 buttons2->addWidget(lastBmkButton, 0, AlignCenter); 262 buttons2->addWidget(lastBmkButton, 0, AlignCenter);
261 buttons2->addWidget(dictionaryButton, 0, AlignCenter); 263 buttons2->addWidget(dictionaryButton, 0, AlignCenter);
262 buttons2->addWidget(InfoBar, 0, AlignCenter); 264 buttons2->addWidget(InfoBar, 0, AlignCenter);
265 buttons2->addStretch(5);
266 buttons2->setSpacing(5);
263 267
264 topLayout->setSpacing(0);
265 topLayout->addLayout( buttons2,0); 268 topLayout->addLayout( buttons2,0);
266} 269}
267 270
268/* STATUSBAR*/ 271/* STATUSBAR*/
269void Gutenbrowser::initStatusBar() 272void Gutenbrowser::initStatusBar()
270{ 273{
271 qDebug("statusbar"); 274 qDebug("statusbar");
272// #ifndef Q_WS_QWS 275// #ifndef Q_WS_QWS
273 276
274// statusBar = new QStatusBar( this, "Status Bar"); 277// statusBar = new QStatusBar( this, "Status Bar");
275// statusBar->message(IDS_STATUS_DEFAULT, 2000); 278// statusBar->message(IDS_STATUS_DEFAULT, 2000);
276// #endif 279// #endif
277} 280}
278 281
279void Gutenbrowser::initView() 282void Gutenbrowser::initView()
280{ 283{
281 // set the main widget here 284 // set the main widget here
282// QFont defaultFont( "charter", 10, 50, 0 ); 285// QFont defaultFont( "charter", 10, 50, 0 );
283 Lview = new MultiLine_Ex(this); 286 Lview = new MultiLine_Ex(this);
284 Config cfg("Gutenbrowser"); 287 Config cfg("Gutenbrowser");
285 cfg.setGroup("Font"); 288 cfg.setGroup("Font");
286 289
287 FontDatabase fdb; 290 FontDatabase fdb;
288 QFont defaultFont = Lview->font(); 291 QFont defaultFont = Lview->font();
289 QFontInfo fontInfo(defaultFont); 292 QFontInfo fontInfo(defaultFont);
290 293
291 QString family = cfg.readEntry("Family", fontInfo.family()); 294 QString family = cfg.readEntry("Family", fontInfo.family());
292 QString style = cfg.readEntry("Style", fdb.styleString(defaultFont)); 295 QString style = cfg.readEntry("Style", fdb.styleString(defaultFont));
293 int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10); 296 int i_size = cfg.readNumEntry("Size", fontInfo.pointSize()/10);
294 QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) ); 297 QString charSet = cfg.readEntry("CharSet", QFont::encodingName( fontInfo.charSet()) );
295 298
296 defaultFont = fdb.font(family,style,i_size,charSet); 299 defaultFont = fdb.font(family,style,i_size,charSet);
297 300
298 QString italic = cfg.readEntry("Italic","FALSE"); 301 QString italic = cfg.readEntry("Italic","FALSE");
299 if(italic=="TRUE") { 302 if(italic=="TRUE") {
300 qDebug("Set Italic font");; 303 qDebug("Set Italic font");;
301 defaultFont = fdb.font( family, "Regular", i_size,charSet); //workaround 304 defaultFont = fdb.font( family, "Regular", i_size,charSet); //workaround
302 defaultFont.setItalic(TRUE); 305 defaultFont.setItalic(TRUE);
303 } 306 }
304 307
305 Lview->setFont( defaultFont); 308 Lview->setFont( defaultFont);
306 update(); 309 update();
307 310
308 cfg.setGroup("General"); 311 cfg.setGroup("General");
309 312
310 if( cfg.readBoolEntry("WordWrap", 1)) { 313 if( cfg.readBoolEntry("WordWrap", 1)) {
311 Lview->setWordWrap(QMultiLineEdit::WidgetWidth); 314 Lview->setWordWrap(QMultiLineEdit::WidgetWidth);
312 useWrap=true; 315 useWrap=true;
313 } else { 316 } else {
314 Lview->setWordWrap(QMultiLineEdit::NoWrap); 317 Lview->setWordWrap(QMultiLineEdit::NoWrap);
315 useWrap = false; 318 useWrap = false;
316 } 319 }
317 mainList = new QListBox(this,"mainlist"); 320 mainList = new QListBox(this,"mainlist");
318 mainList->hide(); 321 mainList->hide();
319// QPEApplication::setStylusOperation( mainList->viewport(),QPEApplication::RightOnHold); 322// QPEApplication::setStylusOperation( mainList->viewport(),QPEApplication::RightOnHold);
320 // mainList->showMaximized(); 323 // mainList->showMaximized();
321// mainList->setGeometry(2,30,230,160); 324// mainList->setGeometry(2,30,230,160);
322 Lview->setReadOnly( true); 325 Lview->setReadOnly( true);
323 edits->addWidget( Lview); 326 edits->addWidget( Lview);
324 edits->addWidget(mainList); 327 edits->addWidget(mainList);
325 328
326// if(!showMainList) { 329// if(!showMainList) {
327// Lview->setText( "\nThis is gutenbrowser for the Sharp Zaurus.\nMake your self at home, sit back, relax and read something great. "); 330// Lview->setText( "\nThis is gutenbrowser for the Sharp Zaurus.\nMake your self at home, sit back, relax and read something great. ");
328// } 331// }
329 // else 332 // else
330// Lview->hide(); 333// Lview->hide();
331 334
332 topLayout->addLayout( edits, 0); 335 topLayout->addLayout( edits, 0);
333 qDebug("end initView"); 336 qDebug("end initView");
334} 337}
335 338
336void Gutenbrowser::hideView() { 339void Gutenbrowser::hideView() {
337 // qWarning("Hide View"); 340 // qWarning("Hide View");
338 mainList->show(); 341 mainList->show();
339 Lview->hide(); 342 Lview->hide();
340} 343}