-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 | |||
@@ -1,332 +1,331 @@ | |||
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 | 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> |
29 | 30 | ||
30 | void Gutenbrowser::initSlots() { | 31 | void Gutenbrowser::initSlots() { |
31 | 32 | ||
32 | connect(LibraryButton,SIGNAL(released()),SLOT(LibraryBtn())); | 33 | connect(LibraryButton,SIGNAL(released()),SLOT(LibraryBtn())); |
33 | connect(OpenButton,SIGNAL(released()),SLOT(OpenBtn())); | 34 | connect(OpenButton,SIGNAL(released()),SLOT(OpenBtn())); |
34 | connect(SearchButton,SIGNAL(released()),SLOT(SearchBtn())); | 35 | connect(SearchButton,SIGNAL(released()),SLOT(SearchBtn())); |
35 | connect(ForwardButton,SIGNAL(clicked()),SLOT(ForwardBtn())); | 36 | connect(ForwardButton,SIGNAL(clicked()),SLOT(ForwardBtn())); |
36 | connect(BackButton,SIGNAL(clicked()),SLOT(BackBtn())); | 37 | connect(BackButton,SIGNAL(clicked()),SLOT(BackBtn())); |
37 | connect(setBookmarkButton,SIGNAL(released()),SLOT(setBookmark())); | 38 | connect(setBookmarkButton,SIGNAL(released()),SLOT(setBookmark())); |
38 | connect(dictionaryButton,SIGNAL(released()),SLOT(LookupBtn())); | 39 | connect(dictionaryButton,SIGNAL(released()),SLOT(LookupBtn())); |
39 | connect(InfoBar,SIGNAL(clicked()),SLOT(InfoBarClick())); | 40 | connect(InfoBar,SIGNAL(clicked()),SLOT(InfoBarClick())); |
40 | connect(qApp,SIGNAL(aboutToQuit()),SLOT(cleanUp())); | 41 | connect(qApp,SIGNAL(aboutToQuit()),SLOT(cleanUp())); |
41 | connect(mainList,SIGNAL(clicked(QListBoxItem *)),SLOT(listClickedSlot(QListBoxItem *))); | 42 | connect(mainList,SIGNAL(clicked(QListBoxItem *)),SLOT(listClickedSlot(QListBoxItem *))); |
42 | connect(bookmarksMenu,SIGNAL(activated(int)),SLOT(Bookmark(int))); | 43 | connect(bookmarksMenu,SIGNAL(activated(int)),SLOT(Bookmark(int))); |
43 | } | 44 | } |
44 | 45 | ||
45 | void Gutenbrowser::initConfig() { | 46 | void Gutenbrowser::initConfig() { |
46 | //odebug << "Starting configuration." << oendl; | 47 | //odebug << "Starting configuration." << oendl; |
47 | QDir library(local_library); | 48 | QDir library(local_library); |
48 | if ( !library.exists()) { | 49 | if ( !library.exists()) { |
49 | library.mkdir(local_library, TRUE); | 50 | library.mkdir(local_library, TRUE); |
50 | QString msg; | 51 | QString msg; |
51 | // #ifndef Q_WS_WIN | 52 | // #ifndef Q_WS_WIN |
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" ); |
77 | QWidget *d = QApplication::desktop(); | 78 | QWidget *d = QApplication::desktop(); |
78 | int width=d->width(); | 79 | int width=d->width(); |
79 | int height=d->height(); | 80 | int height=d->height(); |
80 | int w=0, h=0; | 81 | int w=0, h=0; |
81 | QString str, str2; | 82 | QString str, str2; |
82 | 83 | ||
83 | this->setMaximumWidth(width); | 84 | this->setMaximumWidth(width); |
84 | 85 | ||
85 | if(s_Split=="TRUE") | 86 | if(s_Split=="TRUE") |
86 | useSplitter=TRUE; | 87 | useSplitter=TRUE; |
87 | else | 88 | else |
88 | useSplitter=FALSE; | 89 | useSplitter=FALSE; |
89 | 90 | ||
90 | config.setGroup( "Geometry" ); | 91 | config.setGroup( "Geometry" ); |
91 | if(width < 1030) { | 92 | if(width < 1030) { |
92 | str = config.readEntry("Frame", "700,500"); | 93 | str = config.readEntry("Frame", "700,500"); |
93 | if( !str.isEmpty() && str.find(',')>=0) { | 94 | if( !str.isEmpty() && str.find(',')>=0) { |
94 | sscanf(str,"%d,%d",&w,&h); | 95 | sscanf(str,"%d,%d",&w,&h); |
95 | resize(w,h); | 96 | resize(w,h); |
96 | str2.sprintf("%d,%d", (width-w)/2,(height-h)/2); | 97 | str2.sprintf("%d,%d", (width-w)/2,(height-h)/2); |
97 | str = config.readEntry( "Position", str2); | 98 | str = config.readEntry( "Position", str2); |
98 | } else { | 99 | } else { |
99 | resize( 740,510 ); | 100 | resize( 740,510 ); |
100 | str2.sprintf("%d,%d", (width-w)/2,(height-h)/2); | 101 | str2.sprintf("%d,%d", (width-w)/2,(height-h)/2); |
101 | str = config.readEntry( "Position",str2); | 102 | str = config.readEntry( "Position",str2); |
102 | } | 103 | } |
103 | } else {// desktop is high res | 104 | } else {// desktop is high res |
104 | str = config.readEntry("Frame", "990,640"); | 105 | str = config.readEntry("Frame", "990,640"); |
105 | if( !str.isEmpty() && str.find(',')>=0) { | 106 | if( !str.isEmpty() && str.find(',')>=0) { |
106 | sscanf(str,"%d,%d",&w,&h); | 107 | sscanf(str,"%d,%d",&w,&h); |
107 | resize(w,h); | 108 | resize(w,h); |
108 | str2.sprintf("%d,%d", (width-w)/2,(height-h)/2); | 109 | str2.sprintf("%d,%d", (width-w)/2,(height-h)/2); |
109 | str = config.readEntry( "Position", str2); | 110 | str = config.readEntry( "Position", str2); |
110 | } else { | 111 | } else { |
111 | resize( 990,640 ); | 112 | resize( 990,640 ); |
112 | str2.sprintf("%d,%d", (width-w)/2,(height-h)/2); | 113 | str2.sprintf("%d,%d", (width-w)/2,(height-h)/2); |
113 | str = config.readEntry( "Position", str2); | 114 | str = config.readEntry( "Position", str2); |
114 | } | 115 | } |
115 | } | 116 | } |
116 | int posX, posY; | 117 | int posX, posY; |
117 | bool ok; | 118 | bool ok; |
118 | QString goober; | 119 | QString goober; |
119 | goober=str.left( str.find(",", 0, TRUE) ); | 120 | goober=str.left( str.find(",", 0, TRUE) ); |
120 | posX=goober.toInt( &ok, 10); | 121 | posX=goober.toInt( &ok, 10); |
121 | goober=str.right( str.findRev(",", -1, TRUE) ); | 122 | goober=str.right( str.findRev(",", -1, TRUE) ); |
122 | posY= goober.toInt( &ok, 10); | 123 | posY= goober.toInt( &ok, 10); |
123 | // move( posX, posY); | 124 | // move( posX, posY); |
124 | str = config.readEntry("Icons", "TRUE"); | 125 | str = config.readEntry("Icons", "TRUE"); |
125 | if(str == "TRUE") | 126 | if(str == "TRUE") |
126 | useIcons=TRUE; | 127 | useIcons=TRUE; |
127 | else | 128 | else |
128 | useIcons=FALSE; | 129 | useIcons=FALSE; |
129 | #endif | 130 | #endif |
130 | // #if defined(_WS_WIN_) | 131 | // #if defined(_WS_WIN_) |
131 | // move( posX-4, posY-20); | 132 | // move( posX-4, posY-20); |
132 | // #endif | 133 | // #endif |
133 | 134 | ||
134 | config.setGroup( "Browser" ); | 135 | config.setGroup( "Browser" ); |
135 | brow = config.readEntry( "Preferred", "Opera"); | 136 | brow = config.readEntry( "Preferred", "Opera"); |
136 | config.setGroup( "FTPsite" ); // ftp server config | 137 | config.setGroup( "FTPsite" ); // ftp server config |
137 | ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org"); | 138 | ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org"); |
138 | // ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); | 139 | // ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); |
139 | ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); | 140 | ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); |
140 | ftp_host=ftp_host.stripWhiteSpace(); | 141 | ftp_host=ftp_host.stripWhiteSpace(); |
141 | 142 | ||
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; | 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()) ); |
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 |
181 | 182 | ||
182 | editMenu=new QPopupMenu(); | 183 | editMenu=new QPopupMenu(); |
183 | 184 | ||
184 | editMenu->insertItem(Resource::loadPixmap("up"), "Top", | 185 | editMenu->insertItem(Resource::loadPixmap("up"), "Top", |
185 | this, SLOT(TopBtn()) ); | 186 | this, SLOT(TopBtn()) ); |
186 | editMenu->insertItem( Resource::loadPixmap("back"), "Beginning", | 187 | editMenu->insertItem( Resource::loadPixmap("back"), "Beginning", |
187 | this, SLOT(doBeginBtn()) ); | 188 | this, SLOT(doBeginBtn()) ); |
188 | editMenu->insertItem( Resource::loadPixmap("gutenbrowser/search"), "Search", | 189 | editMenu->insertItem( Resource::loadPixmap("gutenbrowser/search"), "Search", |
189 | this, SLOT(SearchBtn()) ); | 190 | this, SLOT(SearchBtn()) ); |
190 | 191 | ||
191 | editMenu->insertItem("Clear", this, SLOT(ClearEdit()) ); | 192 | editMenu->insertItem("Clear", this, SLOT(ClearEdit()) ); |
192 | 193 | ||
193 | optionsMenu= new QPopupMenu(); | 194 | optionsMenu= new QPopupMenu(); |
194 | optionsMenu->insertItem( Resource::loadPixmap("gutenbrowser/configure"), | 195 | optionsMenu->insertItem( Resource::loadPixmap("gutenbrowser/configure"), |
195 | "Configure", this, SLOT(doOptions()) ); | 196 | "Configure", this, SLOT(doOptions()) ); |
196 | 197 | ||
197 | donateMenu = new QPopupMenu(); | 198 | donateMenu = new QPopupMenu(); |
198 | // donateMenu->insertItem("Gutenberg", this, SLOT(donateGutenberg()) ); | 199 | // donateMenu->insertItem("Gutenberg", this, SLOT(donateGutenberg()) ); |
199 | donateMenu->insertItem( Resource::loadPixmap("gutenbrowser/gutenbrowser_sm"), | 200 | donateMenu->insertItem( Resource::loadPixmap("gutenbrowser/gutenbrowser_sm"), |
200 | "Gutenbrowser Developer", this, SLOT(infoGutenbrowser()) ); | 201 | "Gutenbrowser Developer", this, SLOT(infoGutenbrowser()) ); |
201 | 202 | ||
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 | ||
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); |
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" ); |
231 | SearchButton->setFocusPolicy( QWidget::TabFocus ); | 231 | SearchButton->setFocusPolicy( QWidget::TabFocus ); |
232 | 232 | ||
233 | setBookmarkButton = new QPushButton( this, "setBookmark" ); | 233 | setBookmarkButton = new QPushButton( this, "setBookmark" ); |
234 | setBookmarkButton->setFocusPolicy( QWidget::TabFocus ); | 234 | setBookmarkButton->setFocusPolicy( QWidget::TabFocus ); |
235 | 235 | ||
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*/ |
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 | ||
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 | } |