author | llornkcor <llornkcor> | 2004-07-08 08:37:19 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-07-08 08:37:19 (UTC) |
commit | a53291faf419c90bf22db7cd6d6f26dece2053c1 (patch) (side-by-side diff) | |
tree | d0a5a10621b8705502cc87bde43e18de39042be6 | |
parent | a7b08ae7dbce8675981321828e61c949968d1afe (diff) | |
download | opie-a53291faf419c90bf22db7cd6d6f26dece2053c1.zip opie-a53291faf419c90bf22db7cd6d6f26dece2053c1.tar.gz opie-a53291faf419c90bf22db7cd6d6f26dece2053c1.tar.bz2 |
rework view, fix bookmarking
-rw-r--r-- | noncore/apps/opie-gutenbrowser/gutenbrowser.cpp | 33 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/gutenbrowser.h | 1 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp | 17 |
3 files changed, 33 insertions, 18 deletions
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp index be920dd..d0af114 100644 --- a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp +++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp @@ -161,7 +161,7 @@ Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags ) // Bookmark(); for (int i=1;i< qApp->argc();i++) { qDebug("Suppose we open somethin"); - load(qApp->argv()[i]); + if(!load(qApp->argv()[i])) return; } } else { fillWithTitles(); @@ -170,6 +170,7 @@ Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags ) } writeConfig(); + QTimer::singleShot( 250, this, SLOT(hideView()) ); } //end init Gutenbrowser::~Gutenbrowser() { @@ -410,7 +411,7 @@ void Gutenbrowser::ForwardBtn() { s.replace(QRegExp("\n"),""); insertString+=s; Lview->insertLine( s, -1); - odebug << s << oendl; +// odebug << s << oendl; currentLine++; } // Lview->insertAt( insertString,0,0, FALSE); @@ -579,7 +580,7 @@ void Gutenbrowser::BeginBtn() { if(lastPage < i_pageNum) { pageStopArray.resize(i_pageNum + 1); pageStopArray[i_pageNum ] = currentFilePos; - odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; +// odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; } // lastPage = i_pageNum; if( LeftText.find( s_pattern, 0 , TRUE) != -1 || LeftText.find( sPattern2, 0 , TRUE) != -1 ) { @@ -650,6 +651,7 @@ void Gutenbrowser::setBookmark() { cfg.writeEntry( "LineNumber", QString::number( row)); cfg.writeEntry( "PagePosition", QString::number( pageStopArray[i_pageNum - 1])); cfg.writeEntry( "Page Number", QString::number( i_pageNum) ); + cfg.write(); bookmarksMenu->insertItem( title); } } //end setBookmark @@ -691,7 +693,7 @@ void Gutenbrowser::Bookmark( int itemId) { Lview->clear(); - load(file_name); + if(!load(file_name)) return; int pageSize= Lview->PageSize(); f.at(0); @@ -708,7 +710,7 @@ void Gutenbrowser::Bookmark( int itemId) { if(lastPage < i_pageNum) { pageStopArray.resize(i_pageNum + 1); pageStopArray[i_pageNum ] = currentFilePos; - odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; +// odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; } if(currentFilePos == bookmarkPosition) break; @@ -747,13 +749,15 @@ bool Gutenbrowser::load( const char *fileName) { // QCopEnvelope ( "QPE/System", "busy()" ); odebug << "Title is already set as "+title << oendl; odebug << "sizeHint " << sizeHint().height() << " pageSize " << Lview->PageSize() << "" << oendl; +// pointSize = Lview->fontInfo().pointSize(); +// odebug << "sizeHint " << sizeHint().height() << " point size " << pointSize << "" << oendl; if( Lview->PageSize() < 4) { - Lview->setMaximumHeight( sizeHint().height() ); + // Lview->setMaximumHeight( sizeHint().height() ); Lview->setMinimumHeight( sizeHint().height() ); pointSize = Lview->fontInfo().pointSize(); odebug << "sizeHint " << sizeHint().height() << " point size " << pointSize << "" << oendl; - if(pointSize < 10) + if(pointSize < 15) Lview->setFixedVisibleLines(19); else Lview->setFixedVisibleLines( ( (sizeHint().height() / pointSize ) * 2) -2); @@ -762,6 +766,7 @@ bool Gutenbrowser::load( const char *fileName) { Config cfg("Gutenbrowser"); cfg.setGroup("General"); cfg.writeEntry("Current",fileName); + cfg.write(); currentLine=0; file_name=fileName; @@ -807,7 +812,7 @@ bool Gutenbrowser::load( const char *fileName) { << ", pageSize " << Lview->PageSize() << oendl; Lview->setMaxLines(Lview->PageSize()*2); - odebug << "Gulped " << currentLine << "" << oendl; +// odebug << "Gulped " << currentLine << "" << oendl; setCaption(title); Lview->setAutoUpdate( TRUE); @@ -1036,7 +1041,7 @@ void Gutenbrowser::LibraryBtn() { delete LibraryDlg; setTitle(); // QCopEnvelope ( "QPE/System", "busy()" ); - load( file_name); + if( !load( file_name)) return; } else { printf("Not opening the file.\n"); } @@ -1080,7 +1085,7 @@ void Gutenbrowser::OpenBtn() { } Lview->clear(); // QCopEnvelope ( "QPE/System", "busy()" ); - load(file_name); + if(!load(file_name)) return; } else { odebug << "file_name is empty!" << oendl; if(showMainList) { @@ -1778,7 +1783,7 @@ void Gutenbrowser::listClickedSlot( QListBoxItem * index) { QString file = config.readEntry(temp, ""); odebug << "About to load" << oendl; if( Lview->isVisible()) - load(file); + if(!load(file)) return; config.setGroup( title); file_name = config.readEntry("File Name", ""); @@ -1806,7 +1811,8 @@ void Gutenbrowser::infoGutenbrowser() { } void Gutenbrowser::setDocument(const QString & frozenBoogers) { - this->hide(); +// this->hide(); + qWarning("\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXSET DOCUMENT\n"); if(showMainList) { showMainList=FALSE; if(!mainList->isHidden()) @@ -1817,9 +1823,10 @@ void Gutenbrowser::setDocument(const QString & frozenBoogers) { } DocLnk lnk; lnk = DocLnk(frozenBoogers); + qWarning("open "+frozenBoogers); // odebug << lnk.file() << oendl; title=lnk.comment(); - load( lnk.file()); + if(!load( lnk.file())) return; this->show(); // odebug << title << oendl; // qApp->processEvents(); diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.h b/noncore/apps/opie-gutenbrowser/gutenbrowser.h index acb6e59..2958f01 100644 --- a/noncore/apps/opie-gutenbrowser/gutenbrowser.h +++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.h @@ -162,6 +162,7 @@ protected: protected slots: + void hideView(); void BackBtn(); void Bookmark( int); diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp index 9473ba9..c93dbc5 100644 --- a/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp +++ b/noncore/apps/opie-gutenbrowser/gutenbrowserData.cpp @@ -313,7 +313,7 @@ void Gutenbrowser::initView() useWrap = false; } mainList = new QListBox(this,"mainlist"); - + mainList->hide(); // QPEApplication::setStylusOperation( mainList->viewport(),QPEApplication::RightOnHold); // mainList->showMaximized(); // mainList->setGeometry(2,30,230,160); @@ -321,11 +321,18 @@ void Gutenbrowser::initView() edits->addWidget( Lview); edits->addWidget(mainList); - if(!showMainList) { - Lview->setText( "\nThis is gutenbrowser for the Sharp Zaurus.\nMake your self at home, sit back, relax and read something great. "); - } else - Lview->hide(); +// if(!showMainList) { +// Lview->setText( "\nThis is gutenbrowser for the Sharp Zaurus.\nMake your self at home, sit back, relax and read something great. "); +// } +// else +// Lview->hide(); topLayout->addLayout( edits, 0); qDebug("end initView"); } + +void Gutenbrowser::hideView() { +// qWarning("Hide View"); + mainList->show(); + Lview->hide(); +} |