-rw-r--r-- | noncore/apps/opie-gutenbrowser/gutenbrowser.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp index d0af114..644fae8 100644 --- a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp +++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp @@ -105,68 +105,68 @@ Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags ) initStatusBar(); initView(); initSlots(); qDebug("init finished"); QPEApplication::setStylusOperation( mainList->viewport(),QPEApplication::RightOnHold); connect( mainList, SIGNAL( mouseButtonPressed( int, QListBoxItem *, const QPoint &)), this, SLOT( mainListPressed(int, QListBoxItem *, const QPoint &)) ); if( useIcons) toggleButtonIcons( TRUE); else toggleButtonIcons( FALSE); enableButtons(false); Config config("Gutenbrowser"); // populate menubuttonlist config.setGroup("General"); config.setGroup( "Files" ); QString s_numofFiles = config.readEntry("NumberOfFiles", "0" ); int i_numofFiles = s_numofFiles.toInt(); QString tempFileName; for (int i = 0; i <= i_numofFiles; i++) { // tempFileName.setNum(i); config.setGroup( "Files" ); QString ramble = config.readEntry( QString::number(i), "" ); config.setGroup( "Titles" ); QString tempTitle = config.readEntry( ramble, ""); config.setGroup( tempTitle); - int index=config.readNumEntry( "LineNumber", -1 ); + int index = config.readNumEntry( "LineNumber", -1 ); if( index != -1) { odebug << tempTitle << oendl; - bookmarksMenu->insertItem( tempTitle); + if(!tempTitle.isEmpty()) bookmarksMenu->insertItem( tempTitle); } } // QString gutenIndex= local_library + "GUTINDEX.ALL"; QString gutenIndex = QPEApplication::qpeDir()+ "/etc/gutenbrowser/GUTINDEX.ALL"; qDebug("gutenindex "+gutenIndex ); if( QFile( gutenIndex).exists() ) { indexLib.setName( gutenIndex); } else { QString localLibIndexFile = QPEApplication::qpeDir()+ "/etc/gutenbrowser/PGWHOLE.TXT"; // QString localLibIndexFile= local_library + "PGWHOLE.TXT"; newindexLib.setName( localLibIndexFile); } qDebug("attempting new library"); LibraryDlg = new LibraryDialog( this, "Library Index" /*, TRUE */); loadCheck = false; chdir(local_library); if(!showMainList) { Lview->setFocus(); // if(firstTime) // Bookmark(); for (int i=1;i< qApp->argc();i++) { qDebug("Suppose we open somethin"); if(!load(qApp->argv()[i])) return; } } else { fillWithTitles(); mainList->setFocus(); // mainList->setCurrentItem(0); } writeConfig(); @@ -532,65 +532,65 @@ void Gutenbrowser::TopBtn() { f.at(0); for(int fd=0; fd < pageSize ;fd++) { f.readLine(s, 256); if(useWrap) s.replace(QRegExp("\n"),""); Lview->insertLine(s ,-1); currentLine++; } // Lview->setCursorPosition( 0,0, FALSE); i_pageNum=1; setStatus(); } Lview->setFocus(); } } //moves text to the start of the EText void Gutenbrowser::BeginBtn() { i_pageNum = 1; currentLine = 0; QString s_pattern="*END*THE SMALL PRINT"; QString sPattern2 = "*END THE SMALL PRINT"; int pageSize = Lview->PageSize(); Lview->clear(); // int lines = Lview->numLines(); int pos = 0;//, i = 0; int i_topRow = Lview->topRow(); QString LeftText;// = Lview->text(); - int linesPerPage = Lview->lastRow() - Lview->topRow(); +// int linesPerPage = Lview->lastRow() - Lview->topRow(); // int pages = (( linesPerPage / Lview->editSize() ) ) +1; // int pageN = 0; i_pageNum = 1; int lastPage=1; int lineNo=0; QString s; f.at( 0); while ( !f.atEnd() ) { f.readLine(s, 256); lineNo++; LeftText = s; currentFilePos = f.at(); i_pageNum = lineNo/pageSize; if(lastPage < i_pageNum) { pageStopArray.resize(i_pageNum + 1); pageStopArray[i_pageNum ] = currentFilePos; // 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 ) { odebug << "<<<<<< FOUND IT!! new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; break; } } if(f.atEnd()) //in case we didnt find anything, we need to show something f.at(0); Lview->clear(); for(int fd=0; fd < pageSize - 1;fd++) { f.readLine(s, 256); if(useWrap) |