-rw-r--r-- | noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp | 27 |
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 | |||
@@ -105,224 +105,227 @@ void Gutenbrowser::initConfig() { | |||
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; |
157 | qDebug("lease query before leaving the library.");; | 157 | qDebug("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 | |||
169 | void Gutenbrowser::initMenuBar() | 171 | void 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 | ||
215 | void Gutenbrowser::initButtonBar() | 217 | void 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*/ |
269 | void Gutenbrowser::initStatusBar() | 272 | void 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 | ||
279 | void Gutenbrowser::initView() | 282 | void 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 | // } |