author | llornkcor <llornkcor> | 2004-07-08 08:37:19 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-07-08 08:37:19 (UTC) |
commit | a53291faf419c90bf22db7cd6d6f26dece2053c1 (patch) (unidiff) | |
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 ) | |||
161 | // Bookmark(); | 161 | // Bookmark(); |
162 | for (int i=1;i< qApp->argc();i++) { | 162 | for (int i=1;i< qApp->argc();i++) { |
163 | qDebug("Suppose we open somethin"); | 163 | qDebug("Suppose we open somethin"); |
164 | load(qApp->argv()[i]); | 164 | if(!load(qApp->argv()[i])) return; |
165 | } | 165 | } |
166 | } else { | 166 | } else { |
167 | fillWithTitles(); | 167 | fillWithTitles(); |
@@ -170,6 +170,7 @@ Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags ) | |||
170 | 170 | ||
171 | } | 171 | } |
172 | writeConfig(); | 172 | writeConfig(); |
173 | QTimer::singleShot( 250, this, SLOT(hideView()) ); | ||
173 | } //end init | 174 | } //end init |
174 | 175 | ||
175 | Gutenbrowser::~Gutenbrowser() { | 176 | Gutenbrowser::~Gutenbrowser() { |
@@ -410,7 +411,7 @@ void Gutenbrowser::ForwardBtn() { | |||
410 | s.replace(QRegExp("\n"),""); | 411 | s.replace(QRegExp("\n"),""); |
411 | insertString+=s; | 412 | insertString+=s; |
412 | Lview->insertLine( s, -1); | 413 | Lview->insertLine( s, -1); |
413 | odebug << s << oendl; | 414 | // odebug << s << oendl; |
414 | currentLine++; | 415 | currentLine++; |
415 | } | 416 | } |
416 | // Lview->insertAt( insertString,0,0, FALSE); | 417 | // Lview->insertAt( insertString,0,0, FALSE); |
@@ -579,7 +580,7 @@ void Gutenbrowser::BeginBtn() { | |||
579 | if(lastPage < i_pageNum) { | 580 | if(lastPage < i_pageNum) { |
580 | pageStopArray.resize(i_pageNum + 1); | 581 | pageStopArray.resize(i_pageNum + 1); |
581 | pageStopArray[i_pageNum ] = currentFilePos; | 582 | pageStopArray[i_pageNum ] = currentFilePos; |
582 | odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; | 583 | // odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; |
583 | } | 584 | } |
584 | // lastPage = i_pageNum; | 585 | // lastPage = i_pageNum; |
585 | if( LeftText.find( s_pattern, 0 , TRUE) != -1 || LeftText.find( sPattern2, 0 , TRUE) != -1 ) { | 586 | if( LeftText.find( s_pattern, 0 , TRUE) != -1 || LeftText.find( sPattern2, 0 , TRUE) != -1 ) { |
@@ -650,6 +651,7 @@ void Gutenbrowser::setBookmark() { | |||
650 | cfg.writeEntry( "LineNumber", QString::number( row)); | 651 | cfg.writeEntry( "LineNumber", QString::number( row)); |
651 | cfg.writeEntry( "PagePosition", QString::number( pageStopArray[i_pageNum - 1])); | 652 | cfg.writeEntry( "PagePosition", QString::number( pageStopArray[i_pageNum - 1])); |
652 | cfg.writeEntry( "Page Number", QString::number( i_pageNum) ); | 653 | cfg.writeEntry( "Page Number", QString::number( i_pageNum) ); |
654 | cfg.write(); | ||
653 | bookmarksMenu->insertItem( title); | 655 | bookmarksMenu->insertItem( title); |
654 | } | 656 | } |
655 | } //end setBookmark | 657 | } //end setBookmark |
@@ -691,7 +693,7 @@ void Gutenbrowser::Bookmark( int itemId) { | |||
691 | 693 | ||
692 | Lview->clear(); | 694 | Lview->clear(); |
693 | 695 | ||
694 | load(file_name); | 696 | if(!load(file_name)) return; |
695 | 697 | ||
696 | int pageSize= Lview->PageSize(); | 698 | int pageSize= Lview->PageSize(); |
697 | f.at(0); | 699 | f.at(0); |
@@ -708,7 +710,7 @@ void Gutenbrowser::Bookmark( int itemId) { | |||
708 | if(lastPage < i_pageNum) { | 710 | if(lastPage < i_pageNum) { |
709 | pageStopArray.resize(i_pageNum + 1); | 711 | pageStopArray.resize(i_pageNum + 1); |
710 | pageStopArray[i_pageNum ] = currentFilePos; | 712 | pageStopArray[i_pageNum ] = currentFilePos; |
711 | odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; | 713 | // odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; |
712 | } | 714 | } |
713 | if(currentFilePos == bookmarkPosition) | 715 | if(currentFilePos == bookmarkPosition) |
714 | break; | 716 | break; |
@@ -747,13 +749,15 @@ bool Gutenbrowser::load( const char *fileName) { | |||
747 | // QCopEnvelope ( "QPE/System", "busy()" ); | 749 | // QCopEnvelope ( "QPE/System", "busy()" ); |
748 | odebug << "Title is already set as "+title << oendl; | 750 | odebug << "Title is already set as "+title << oendl; |
749 | odebug << "sizeHint " << sizeHint().height() << " pageSize " << Lview->PageSize() << "" << oendl; | 751 | odebug << "sizeHint " << sizeHint().height() << " pageSize " << Lview->PageSize() << "" << oendl; |
752 | // pointSize = Lview->fontInfo().pointSize(); | ||
753 | // odebug << "sizeHint " << sizeHint().height() << " point size " << pointSize << "" << oendl; | ||
750 | if( Lview->PageSize() < 4) { | 754 | if( Lview->PageSize() < 4) { |
751 | 755 | ||
752 | Lview->setMaximumHeight( sizeHint().height() ); | 756 | //Lview->setMaximumHeight( sizeHint().height() ); |
753 | Lview->setMinimumHeight( sizeHint().height() ); | 757 | Lview->setMinimumHeight( sizeHint().height() ); |
754 | pointSize = Lview->fontInfo().pointSize(); | 758 | pointSize = Lview->fontInfo().pointSize(); |
755 | odebug << "sizeHint " << sizeHint().height() << " point size " << pointSize << "" << oendl; | 759 | odebug << "sizeHint " << sizeHint().height() << " point size " << pointSize << "" << oendl; |
756 | if(pointSize < 10) | 760 | if(pointSize < 15) |
757 | Lview->setFixedVisibleLines(19); | 761 | Lview->setFixedVisibleLines(19); |
758 | else | 762 | else |
759 | Lview->setFixedVisibleLines( ( (sizeHint().height() / pointSize ) * 2) -2); | 763 | Lview->setFixedVisibleLines( ( (sizeHint().height() / pointSize ) * 2) -2); |
@@ -762,6 +766,7 @@ bool Gutenbrowser::load( const char *fileName) { | |||
762 | Config cfg("Gutenbrowser"); | 766 | Config cfg("Gutenbrowser"); |
763 | cfg.setGroup("General"); | 767 | cfg.setGroup("General"); |
764 | cfg.writeEntry("Current",fileName); | 768 | cfg.writeEntry("Current",fileName); |
769 | cfg.write(); | ||
765 | currentLine=0; | 770 | currentLine=0; |
766 | 771 | ||
767 | file_name=fileName; | 772 | file_name=fileName; |
@@ -807,7 +812,7 @@ bool Gutenbrowser::load( const char *fileName) { | |||
807 | << ", pageSize " << Lview->PageSize() << oendl; | 812 | << ", pageSize " << Lview->PageSize() << oendl; |
808 | 813 | ||
809 | Lview->setMaxLines(Lview->PageSize()*2); | 814 | Lview->setMaxLines(Lview->PageSize()*2); |
810 | odebug << "Gulped " << currentLine << "" << oendl; | 815 | // odebug << "Gulped " << currentLine << "" << oendl; |
811 | setCaption(title); | 816 | setCaption(title); |
812 | Lview->setAutoUpdate( TRUE); | 817 | Lview->setAutoUpdate( TRUE); |
813 | 818 | ||
@@ -1036,7 +1041,7 @@ void Gutenbrowser::LibraryBtn() { | |||
1036 | delete LibraryDlg; | 1041 | delete LibraryDlg; |
1037 | setTitle(); | 1042 | setTitle(); |
1038 | // QCopEnvelope ( "QPE/System", "busy()" ); | 1043 | // QCopEnvelope ( "QPE/System", "busy()" ); |
1039 | load( file_name); | 1044 | if( !load( file_name)) return; |
1040 | } else { | 1045 | } else { |
1041 | printf("Not opening the file.\n"); | 1046 | printf("Not opening the file.\n"); |
1042 | } | 1047 | } |
@@ -1080,7 +1085,7 @@ void Gutenbrowser::OpenBtn() { | |||
1080 | } | 1085 | } |
1081 | Lview->clear(); | 1086 | Lview->clear(); |
1082 | // QCopEnvelope ( "QPE/System", "busy()" ); | 1087 | // QCopEnvelope ( "QPE/System", "busy()" ); |
1083 | load(file_name); | 1088 | if(!load(file_name)) return; |
1084 | } else { | 1089 | } else { |
1085 | odebug << "file_name is empty!" << oendl; | 1090 | odebug << "file_name is empty!" << oendl; |
1086 | if(showMainList) { | 1091 | if(showMainList) { |
@@ -1778,7 +1783,7 @@ void Gutenbrowser::listClickedSlot( QListBoxItem * index) { | |||
1778 | QString file = config.readEntry(temp, ""); | 1783 | QString file = config.readEntry(temp, ""); |
1779 | odebug << "About to load" << oendl; | 1784 | odebug << "About to load" << oendl; |
1780 | if( Lview->isVisible()) | 1785 | if( Lview->isVisible()) |
1781 | load(file); | 1786 | if(!load(file)) return; |
1782 | 1787 | ||
1783 | config.setGroup( title); | 1788 | config.setGroup( title); |
1784 | file_name = config.readEntry("File Name", ""); | 1789 | file_name = config.readEntry("File Name", ""); |
@@ -1806,7 +1811,8 @@ void Gutenbrowser::infoGutenbrowser() { | |||
1806 | } | 1811 | } |
1807 | 1812 | ||
1808 | void Gutenbrowser::setDocument(const QString & frozenBoogers) { | 1813 | void Gutenbrowser::setDocument(const QString & frozenBoogers) { |
1809 | this->hide(); | 1814 | // this->hide(); |
1815 | qWarning("\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXSET DOCUMENT\n"); | ||
1810 | if(showMainList) { | 1816 | if(showMainList) { |
1811 | showMainList=FALSE; | 1817 | showMainList=FALSE; |
1812 | if(!mainList->isHidden()) | 1818 | if(!mainList->isHidden()) |
@@ -1817,9 +1823,10 @@ void Gutenbrowser::setDocument(const QString & frozenBoogers) { | |||
1817 | } | 1823 | } |
1818 | DocLnk lnk; | 1824 | DocLnk lnk; |
1819 | lnk = DocLnk(frozenBoogers); | 1825 | lnk = DocLnk(frozenBoogers); |
1826 | qWarning("open "+frozenBoogers); | ||
1820 | // odebug << lnk.file() << oendl; | 1827 | // odebug << lnk.file() << oendl; |
1821 | title=lnk.comment(); | 1828 | title=lnk.comment(); |
1822 | load( lnk.file()); | 1829 | if(!load( lnk.file())) return; |
1823 | this->show(); | 1830 | this->show(); |
1824 | // odebug << title << oendl; | 1831 | // odebug << title << oendl; |
1825 | // qApp->processEvents(); | 1832 | // 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: | |||
162 | 162 | ||
163 | 163 | ||
164 | protected slots: | 164 | protected slots: |
165 | void hideView(); | ||
165 | 166 | ||
166 | void BackBtn(); | 167 | void BackBtn(); |
167 | void Bookmark( int); | 168 | 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() | |||
313 | useWrap = false; | 313 | useWrap = false; |
314 | } | 314 | } |
315 | mainList = new QListBox(this,"mainlist"); | 315 | mainList = new QListBox(this,"mainlist"); |
316 | 316 | mainList->hide(); | |
317 | // QPEApplication::setStylusOperation( mainList->viewport(),QPEApplication::RightOnHold); | 317 | // QPEApplication::setStylusOperation( mainList->viewport(),QPEApplication::RightOnHold); |
318 | // mainList->showMaximized(); | 318 | // mainList->showMaximized(); |
319 | // mainList->setGeometry(2,30,230,160); | 319 | // mainList->setGeometry(2,30,230,160); |
@@ -321,11 +321,18 @@ void Gutenbrowser::initView() | |||
321 | edits->addWidget( Lview); | 321 | edits->addWidget( Lview); |
322 | edits->addWidget(mainList); | 322 | edits->addWidget(mainList); |
323 | 323 | ||
324 | if(!showMainList) { | 324 | // if(!showMainList) { |
325 | 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. "); |
326 | } else | 326 | // } |
327 | Lview->hide(); | 327 | // else |
328 | // Lview->hide(); | ||
328 | 329 | ||
329 | topLayout->addLayout( edits, 0); | 330 | topLayout->addLayout( edits, 0); |
330 | qDebug("end initView"); | 331 | qDebug("end initView"); |
331 | } | 332 | } |
333 | |||
334 | void Gutenbrowser::hideView() { | ||
335 | // qWarning("Hide View"); | ||
336 | mainList->show(); | ||
337 | Lview->hide(); | ||
338 | } | ||