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 | |||
@@ -152,33 +152,34 @@ Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags ) | |||
152 | newindexLib.setName( localLibIndexFile); | 152 | newindexLib.setName( localLibIndexFile); |
153 | } | 153 | } |
154 | qDebug("attempting new library"); | 154 | qDebug("attempting new library"); |
155 | LibraryDlg = new LibraryDialog( this, "Library Index" /*, TRUE */); | 155 | LibraryDlg = new LibraryDialog( this, "Library Index" /*, TRUE */); |
156 | loadCheck = false; | 156 | loadCheck = false; |
157 | chdir(local_library); | 157 | chdir(local_library); |
158 | if(!showMainList) { | 158 | if(!showMainList) { |
159 | Lview->setFocus(); | 159 | Lview->setFocus(); |
160 | // if(firstTime) | 160 | // if(firstTime) |
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(); |
168 | mainList->setFocus(); | 168 | mainList->setFocus(); |
169 | // mainList->setCurrentItem(0); | 169 | // mainList->setCurrentItem(0); |
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() { |
176 | // QPEApplication::grabKeyboard(); | 177 | // QPEApplication::grabKeyboard(); |
177 | // QPEApplication::ungrabKeyboard(); | 178 | // QPEApplication::ungrabKeyboard(); |
178 | odebug << "Exit" << oendl; | 179 | odebug << "Exit" << oendl; |
179 | } | 180 | } |
180 | 181 | ||
181 | /* | 182 | /* |
182 | Google.com search */ | 183 | Google.com search */ |
183 | void Gutenbrowser::InfoBarClick() { | 184 | void Gutenbrowser::InfoBarClick() { |
184 | QString text; | 185 | QString text; |
@@ -401,25 +402,25 @@ void Gutenbrowser::ForwardBtn() { | |||
401 | 402 | ||
402 | QString s; | 403 | QString s; |
403 | QString insertString; | 404 | QString insertString; |
404 | int pageSize= Lview->PageSize(); | 405 | int pageSize= Lview->PageSize(); |
405 | Lview->clear(); | 406 | Lview->clear(); |
406 | 407 | ||
407 | for(int fd=0; fd < pageSize - 1;fd++) { | 408 | for(int fd=0; fd < pageSize - 1;fd++) { |
408 | f.readLine(s, 256); | 409 | f.readLine(s, 256); |
409 | if(useWrap) | 410 | if(useWrap) |
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); |
417 | currentFilePos = f.at(); | 418 | currentFilePos = f.at(); |
418 | // if( i_pageNum != pages) { | 419 | // if( i_pageNum != pages) { |
419 | // Lview->MultiLine_Ex::pageDown( FALSE); | 420 | // Lview->MultiLine_Ex::pageDown( FALSE); |
420 | i_pageNum++; | 421 | i_pageNum++; |
421 | pageStopArray.resize(i_pageNum + 1); | 422 | pageStopArray.resize(i_pageNum + 1); |
422 | // int length = Lview->length(); | 423 | // int length = Lview->length(); |
423 | 424 | ||
424 | pageStopArray[i_pageNum ] = currentFilePos; | 425 | pageStopArray[i_pageNum ] = currentFilePos; |
425 | odebug << currentFilePos << " current page is number " << i_pageNum | 426 | odebug << currentFilePos << " current page is number " << i_pageNum |
@@ -570,25 +571,25 @@ void Gutenbrowser::BeginBtn() { | |||
570 | f.at( 0); | 571 | f.at( 0); |
571 | 572 | ||
572 | while ( !f.atEnd() ) { | 573 | while ( !f.atEnd() ) { |
573 | f.readLine(s, 256); | 574 | f.readLine(s, 256); |
574 | lineNo++; | 575 | lineNo++; |
575 | LeftText = s; | 576 | LeftText = s; |
576 | currentFilePos = f.at(); | 577 | currentFilePos = f.at(); |
577 | 578 | ||
578 | i_pageNum = lineNo/pageSize; | 579 | i_pageNum = lineNo/pageSize; |
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 ) { |
586 | odebug << "<<<<<< FOUND IT!! new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; | 587 | odebug << "<<<<<< FOUND IT!! new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; |
587 | break; | 588 | break; |
588 | } | 589 | } |
589 | } | 590 | } |
590 | if(f.atEnd()) //in case we didnt find anything, we need to show something | 591 | if(f.atEnd()) //in case we didnt find anything, we need to show something |
591 | f.at(0); | 592 | f.at(0); |
592 | Lview->clear(); | 593 | Lview->clear(); |
593 | for(int fd=0; fd < pageSize - 1;fd++) { | 594 | for(int fd=0; fd < pageSize - 1;fd++) { |
594 | f.readLine(s, 256); | 595 | f.readLine(s, 256); |
@@ -641,24 +642,25 @@ void Gutenbrowser::setBookmark() { | |||
641 | cfg.writeEntry("Page Number",QString::number(i_pageNum) ); | 642 | cfg.writeEntry("Page Number",QString::number(i_pageNum) ); |
642 | cfg.writeEntry( "PagePosition", QString::number( pageStopArray[i_pageNum - 1])); | 643 | cfg.writeEntry( "PagePosition", QString::number( pageStopArray[i_pageNum - 1])); |
643 | cfg.writeEntry("Title", title); | 644 | cfg.writeEntry("Title", title); |
644 | 645 | ||
645 | int row = Lview->topRow();// Lview->Top(); | 646 | int row = Lview->topRow();// Lview->Top(); |
646 | cfg.writeEntry("LineNumber",QString::number(row) ); | 647 | cfg.writeEntry("LineNumber",QString::number(row) ); |
647 | 648 | ||
648 | cfg.setGroup(title); | 649 | cfg.setGroup(title); |
649 | cfg.writeEntry("File Name",file_name); | 650 | cfg.writeEntry("File Name",file_name); |
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 |
656 | 658 | ||
657 | 659 | ||
658 | /* goes to last set bookmark*/ | 660 | /* goes to last set bookmark*/ |
659 | void Gutenbrowser::Bookmark( int itemId) { | 661 | void Gutenbrowser::Bookmark( int itemId) { |
660 | 662 | ||
661 | // qApp->processEvents(); | 663 | // qApp->processEvents(); |
662 | Config config("Gutenbrowser"); | 664 | Config config("Gutenbrowser"); |
663 | config.setGroup( "Bookmarks" ); | 665 | config.setGroup( "Bookmarks" ); |
664 | 666 | ||
@@ -682,42 +684,42 @@ void Gutenbrowser::Bookmark( int itemId) { | |||
682 | Bmrkrow = config.readNumEntry("LineNumber",0); | 684 | Bmrkrow = config.readNumEntry("LineNumber",0); |
683 | if( !file_name.contains("/")) { | 685 | if( !file_name.contains("/")) { |
684 | file_name = local_library + file_name; | 686 | file_name = local_library + file_name; |
685 | } | 687 | } |
686 | 688 | ||
687 | // getTitle(file_name); | 689 | // getTitle(file_name); |
688 | // qApp->processEvents(); | 690 | // qApp->processEvents(); |
689 | // Lview->setFocus(); | 691 | // Lview->setFocus(); |
690 | this->setFocus(); | 692 | this->setFocus(); |
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); |
698 | // Lview->clear(); | 700 | // Lview->clear(); |
699 | QString s; | 701 | QString s; |
700 | int lineNo=0; | 702 | int lineNo=0; |
701 | int lastPage=1; | 703 | int lastPage=1; |
702 | while ( !f.atEnd() ) { | 704 | while ( !f.atEnd() ) { |
703 | f.readLine(s, 256); | 705 | f.readLine(s, 256); |
704 | lineNo++; | 706 | lineNo++; |
705 | currentFilePos = f.at(); | 707 | currentFilePos = f.at(); |
706 | 708 | ||
707 | i_pageNum = lineNo/pageSize; | 709 | i_pageNum = lineNo/pageSize; |
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; |
715 | } | 717 | } |
716 | if(f.atEnd()) | 718 | if(f.atEnd()) |
717 | f.at(0); | 719 | f.at(0); |
718 | else | 720 | else |
719 | f.at( bookmarkPosition); | 721 | f.at( bookmarkPosition); |
720 | 722 | ||
721 | for(int fd=0; fd < pageSize - 1;fd++) { | 723 | for(int fd=0; fd < pageSize - 1;fd++) { |
722 | f.readLine(s, 256); | 724 | f.readLine(s, 256); |
723 | lineNo++; | 725 | lineNo++; |
@@ -738,39 +740,42 @@ void Gutenbrowser::Bookmark( int itemId) { | |||
738 | } | 740 | } |
739 | 741 | ||
740 | odebug << "bookmark loaded" << oendl; | 742 | odebug << "bookmark loaded" << oendl; |
741 | setCaption(title); | 743 | setCaption(title); |
742 | } | 744 | } |
743 | 745 | ||
744 | 746 | ||
745 | bool Gutenbrowser::load( const char *fileName) { | 747 | bool Gutenbrowser::load( const char *fileName) { |
746 | 748 | ||
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); |
760 | } | 764 | } |
761 | 765 | ||
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; |
768 | QString o_file = fileName; | 773 | QString o_file = fileName; |
769 | 774 | ||
770 | // if (i_pageNum < 1) { | 775 | // if (i_pageNum < 1) { |
771 | i_pageNum = 1; | 776 | i_pageNum = 1; |
772 | // } | 777 | // } |
773 | odebug << "ready to open "+o_file << oendl; | 778 | odebug << "ready to open "+o_file << oendl; |
774 | 779 | ||
775 | if(f.isOpen()) f.close(); | 780 | if(f.isOpen()) f.close(); |
776 | f.setName( o_file); | 781 | f.setName( o_file); |
@@ -798,25 +803,25 @@ bool Gutenbrowser::load( const char *fileName) { | |||
798 | } | 803 | } |
799 | 804 | ||
800 | // int length = Lview->length(); | 805 | // int length = Lview->length(); |
801 | currentFilePos = f.at(); | 806 | currentFilePos = f.at(); |
802 | 807 | ||
803 | pageStopArray[1] = currentFilePos; | 808 | pageStopArray[1] = currentFilePos; |
804 | 809 | ||
805 | odebug << "<<<<<<<<<<<" << currentFilePos << " current page is number " << i_pageNum | 810 | odebug << "<<<<<<<<<<<" << currentFilePos << " current page is number " << i_pageNum |
806 | << ", length " << Lview->length() << ", current " << pageStopArray[i_pageNum] | 811 | << ", length " << Lview->length() << ", current " << pageStopArray[i_pageNum] |
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 | ||
814 | // Lview->setCursorPosition(0,0,FALSE); | 819 | // Lview->setCursorPosition(0,0,FALSE); |
815 | 820 | ||
816 | // pages = (int)(( Lview->numLines() / Lview->editSize() ) / 2 ) +1; | 821 | // pages = (int)(( Lview->numLines() / Lview->editSize() ) / 2 ) +1; |
817 | //odebug << "number of pages " << pages << "" << oendl; | 822 | //odebug << "number of pages " << pages << "" << oendl; |
818 | 823 | ||
819 | loadCheck = true; | 824 | loadCheck = true; |
820 | enableButtons(true); | 825 | enableButtons(true); |
821 | if( donateMenu->count() == 3) { | 826 | if( donateMenu->count() == 3) { |
822 | donateMenu->insertItem("Current Title", this, SLOT( InfoBarClick() )); | 827 | donateMenu->insertItem("Current Title", this, SLOT( InfoBarClick() )); |
@@ -1027,25 +1032,25 @@ void Gutenbrowser::LibraryBtn() { | |||
1027 | // unzipProc=new QProcess( this, "unzipProc" ); /// fark that idea! | 1032 | // unzipProc=new QProcess( this, "unzipProc" ); /// fark that idea! |
1028 | // unzipProc->start(); | 1033 | // unzipProc->start(); |
1029 | system(cmd); | 1034 | system(cmd); |
1030 | remove( file_name); | 1035 | remove( file_name); |
1031 | 1036 | ||
1032 | } | 1037 | } |
1033 | // // | 1038 | // // |
1034 | // file_name = file_name.left(4)+ ".txt"; | 1039 | // file_name = file_name.left(4)+ ".txt"; |
1035 | if( LibraryDlg) | 1040 | if( LibraryDlg) |
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 | } |
1043 | } | 1048 | } |
1044 | } | 1049 | } |
1045 | if(showMainList) { | 1050 | if(showMainList) { |
1046 | if(!Lview->isHidden()) | 1051 | if(!Lview->isHidden()) |
1047 | Lview->hide(); | 1052 | Lview->hide(); |
1048 | qApp->processEvents(); | 1053 | qApp->processEvents(); |
1049 | showMainList=TRUE; | 1054 | showMainList=TRUE; |
1050 | if(mainList->isHidden()) | 1055 | if(mainList->isHidden()) |
1051 | mainList->show(); | 1056 | mainList->show(); |
@@ -1071,25 +1076,25 @@ void Gutenbrowser::OpenBtn() { | |||
1071 | i_pageNum = 1; | 1076 | i_pageNum = 1; |
1072 | 1077 | ||
1073 | if( !file_name.isEmpty() || file_name.length() > 2 ) { | 1078 | if( !file_name.isEmpty() || file_name.length() > 2 ) { |
1074 | if(showMainList) { | 1079 | if(showMainList) { |
1075 | showMainList=FALSE; | 1080 | showMainList=FALSE; |
1076 | odebug << "ShowMainList is now false" << oendl; | 1081 | odebug << "ShowMainList is now false" << oendl; |
1077 | mainList->hide(); | 1082 | mainList->hide(); |
1078 | Lview->show(); | 1083 | Lview->show(); |
1079 | qApp->processEvents(); | 1084 | qApp->processEvents(); |
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) { |
1087 | if(!Lview->isHidden()) | 1092 | if(!Lview->isHidden()) |
1088 | Lview->hide(); | 1093 | Lview->hide(); |
1089 | qApp->processEvents(); | 1094 | qApp->processEvents(); |
1090 | if(mainList->isHidden()) | 1095 | if(mainList->isHidden()) |
1091 | mainList->show(); | 1096 | mainList->show(); |
1092 | fillWithTitles(); | 1097 | fillWithTitles(); |
1093 | qApp->processEvents(); | 1098 | qApp->processEvents(); |
1094 | } | 1099 | } |
1095 | 1100 | ||
@@ -1769,25 +1774,25 @@ void Gutenbrowser::listClickedSlot( QListBoxItem * index) { | |||
1769 | showMainList=FALSE; | 1774 | showMainList=FALSE; |
1770 | mainList->hide(); | 1775 | mainList->hide(); |
1771 | Lview->show(); | 1776 | Lview->show(); |
1772 | qApp->processEvents(); | 1777 | qApp->processEvents(); |
1773 | QString temp; | 1778 | QString temp; |
1774 | temp.setNum( mainList->currentItem() + 1); | 1779 | temp.setNum( mainList->currentItem() + 1); |
1775 | // openFileTitle = title; | 1780 | // openFileTitle = title; |
1776 | Config config("Gutenbrowser"); | 1781 | Config config("Gutenbrowser"); |
1777 | config.setGroup( "Files" ); | 1782 | config.setGroup( "Files" ); |
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", ""); |
1785 | i_pageNum = config.readNumEntry("Page Number", 1); | 1790 | i_pageNum = config.readNumEntry("Page Number", 1); |
1786 | int Bmrkrow = config.readNumEntry("LineNumber", -1); | 1791 | int Bmrkrow = config.readNumEntry("LineNumber", -1); |
1787 | if(Bmrkrow > -1) { | 1792 | if(Bmrkrow > -1) { |
1788 | if( Bmrkrow > Lview->topRow() ) { | 1793 | if( Bmrkrow > Lview->topRow() ) { |
1789 | // Lview->setCursorPosition( Bmrkrow /* - Lview->topRow() */,0, FALSE ); | 1794 | // Lview->setCursorPosition( Bmrkrow /* - Lview->topRow() */,0, FALSE ); |
1790 | Lview->ScrollUp( Bmrkrow - Lview->topRow() ); | 1795 | Lview->ScrollUp( Bmrkrow - Lview->topRow() ); |
1791 | // AdjustStatus(); | 1796 | // AdjustStatus(); |
1792 | } | 1797 | } |
1793 | else if( Bmrkrow < Lview->topRow() ) { | 1798 | else if( Bmrkrow < Lview->topRow() ) { |
@@ -1797,38 +1802,40 @@ void Gutenbrowser::listClickedSlot( QListBoxItem * index) { | |||
1797 | } | 1802 | } |
1798 | } | 1803 | } |
1799 | } | 1804 | } |
1800 | } | 1805 | } |
1801 | 1806 | ||
1802 | void Gutenbrowser::infoGutenbrowser() { | 1807 | void Gutenbrowser::infoGutenbrowser() { |
1803 | QMessageBox::message("Info","Gutenbrowser was developed by\n" | 1808 | QMessageBox::message("Info","Gutenbrowser was developed by\n" |
1804 | "Lorn Potter\n" | 1809 | "Lorn Potter\n" |
1805 | "ljp<ljp@llornkcor.com>\n"); | 1810 | "ljp<ljp@llornkcor.com>\n"); |
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()) |
1813 | mainList->hide(); | 1819 | mainList->hide(); |
1814 | if(Lview->isHidden()) | 1820 | if(Lview->isHidden()) |
1815 | Lview->show(); | 1821 | Lview->show(); |
1816 | qApp->processEvents(); | 1822 | qApp->processEvents(); |
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(); |
1826 | // repaint(); | 1833 | // repaint(); |
1827 | } | 1834 | } |
1828 | 1835 | ||
1829 | void Gutenbrowser::mainListPressed(int mouse, QListBoxItem * , const QPoint & ) | 1836 | void Gutenbrowser::mainListPressed(int mouse, QListBoxItem * , const QPoint & ) |
1830 | { | 1837 | { |
1831 | switch (mouse) { | 1838 | switch (mouse) { |
1832 | case 1: | 1839 | case 1: |
1833 | break; | 1840 | break; |
1834 | case 2: { | 1841 | case 2: { |
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 | |||
@@ -153,24 +153,25 @@ private slots: | |||
153 | 153 | ||
154 | protected: | 154 | protected: |
155 | 155 | ||
156 | bool UnZipIt(const QString &zipFile); | 156 | bool UnZipIt(const QString &zipFile); |
157 | bool b_queryExit; | 157 | bool b_queryExit; |
158 | bool queryExit(); | 158 | bool queryExit(); |
159 | bool showMainList; | 159 | bool showMainList; |
160 | bool useIcons; | 160 | bool useIcons; |
161 | bool working; | 161 | bool working; |
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); |
168 | void ByeBye(); | 169 | void ByeBye(); |
169 | void ChangeFont(); | 170 | void ChangeFont(); |
170 | void ClearEdit(); | 171 | void ClearEdit(); |
171 | void DownloadIndex(); | 172 | void DownloadIndex(); |
172 | void ForwardBtn(); | 173 | void ForwardBtn(); |
173 | void HelpBtn(); | 174 | void HelpBtn(); |
174 | void InfoBarClick(); | 175 | void InfoBarClick(); |
175 | void LibraryBtn(); | 176 | void LibraryBtn(); |
176 | void LookupBtn(); | 177 | void LookupBtn(); |
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 | |||
@@ -304,28 +304,35 @@ void Gutenbrowser::initView() | |||
304 | update(); | 304 | update(); |
305 | 305 | ||
306 | cfg.setGroup("General"); | 306 | cfg.setGroup("General"); |
307 | 307 | ||
308 | if( cfg.readBoolEntry("WordWrap", 1)) { | 308 | if( cfg.readBoolEntry("WordWrap", 1)) { |
309 | Lview->setWordWrap(QMultiLineEdit::WidgetWidth); | 309 | Lview->setWordWrap(QMultiLineEdit::WidgetWidth); |
310 | useWrap=true; | 310 | useWrap=true; |
311 | } else { | 311 | } else { |
312 | Lview->setWordWrap(QMultiLineEdit::NoWrap); | 312 | Lview->setWordWrap(QMultiLineEdit::NoWrap); |
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); |
320 | Lview->setReadOnly( true); | 320 | Lview->setReadOnly( true); |
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 | } | ||