author | llornkcor <llornkcor> | 2004-06-15 09:51:02 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-06-15 09:51:02 (UTC) |
commit | 83b4b2d2670b63a2a540006cea2ea8808100d308 (patch) (unidiff) | |
tree | 577fc60d3b2f63374c7bceeea311f2dc28f99e8e | |
parent | 631bd9765ed1d4e53ee8b021da644e0cfdcd623c (diff) | |
download | opie-83b4b2d2670b63a2a540006cea2ea8808100d308.zip opie-83b4b2d2670b63a2a540006cea2ea8808100d308.tar.gz opie-83b4b2d2670b63a2a540006cea2ea8808100d308.tar.bz2 |
load guten library, and fix some dialogs
-rw-r--r-- | noncore/apps/opie-gutenbrowser/LibraryDialog.cpp | 10 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-gutenbrowser/gutenbrowser.cpp | 82 |
3 files changed, 47 insertions, 48 deletions
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp index 270a4cf..124b6f3 100644 --- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp | |||
@@ -77,24 +77,26 @@ LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool modal, W | |||
77 | 77 | ||
78 | config.setGroup("SortAuth"); | 78 | config.setGroup("SortAuth"); |
79 | if( config.readEntry("authSort", "FALSE") == "TRUE") | 79 | if( config.readEntry("authSort", "FALSE") == "TRUE") |
80 | authBox->setChecked(TRUE); | 80 | authBox->setChecked(TRUE); |
81 | 81 | ||
82 | config.setGroup("General"); | 82 | config.setGroup("General"); |
83 | downDir =config.readEntry( "DownloadDirectory",local_library); | 83 | downDir =config.readEntry( "DownloadDirectory",local_library); |
84 | odebug << "downDir is "+downDir << oendl; | 84 | odebug << "downDir is "+downDir << oendl; |
85 | newindexLib.setName( old_index); | 85 | newindexLib.setName( old_index); |
86 | indexLib.setName( old_index); | 86 | indexLib.setName( old_index); |
87 | 87 | ||
88 | new QPEDialogListener(this); | 88 | new QPEDialogListener(this); |
89 | QTimer::singleShot( 1000, this, SLOT( FindLibrary()) ); | ||
90 | |||
89 | } | 91 | } |
90 | 92 | ||
91 | LibraryDialog::~LibraryDialog() | 93 | LibraryDialog::~LibraryDialog() |
92 | { | 94 | { |
93 | // delete QList_Item2; | 95 | // delete QList_Item2; |
94 | // delete QList_Item1; | 96 | // delete QList_Item1; |
95 | // delete QList_Item3; | 97 | // delete QList_Item3; |
96 | // delete QList_Item4; | 98 | // delete QList_Item4; |
97 | // delete QList_Item5; | 99 | // delete QList_Item5; |
98 | 100 | ||
99 | // saveConfig(); | 101 | // saveConfig(); |
100 | } | 102 | } |
@@ -246,25 +248,25 @@ void LibraryDialog::Library() | |||
246 | 248 | ||
247 | else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) || | 249 | else if( (author.left(1) >= QString("S") && author.left(1) <= QString("Z")) || |
248 | (author.left(1) >= QString("s") && author.left(1) <= QString("z")) ) | 250 | (author.left(1) >= QString("s") && author.left(1) <= QString("z")) ) |
249 | QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file ); | 251 | QList_Item4 = new QListViewItem( ListView4, /* number,*/ title, author, year, file ); |
250 | } | 252 | } |
251 | } | 253 | } |
252 | } | 254 | } |
253 | } | 255 | } |
254 | } | 256 | } |
255 | indexLib.close(); | 257 | indexLib.close(); |
256 | } else { | 258 | } else { |
257 | QString sMsg; | 259 | QString sMsg; |
258 | sMsg = ( tr("Error opening local library index:\n "))+local_index; | 260 | sMsg = ( tr("<p>Error opening local library index:</P> "))+local_index; |
259 | QMessageBox::message( "Error",sMsg); | 261 | QMessageBox::message( "Error",sMsg); |
260 | } | 262 | } |
261 | 263 | ||
262 | } //end Library() | 264 | } //end Library() |
263 | 265 | ||
264 | 266 | ||
265 | /* | 267 | /* |
266 | Groks the author out of the title */ | 268 | Groks the author out of the title */ |
267 | bool LibraryDialog::getAuthor() | 269 | bool LibraryDialog::getAuthor() |
268 | { | 270 | { |
269 | if( title.contains( ", by", TRUE)) { | 271 | if( title.contains( ", by", TRUE)) { |
270 | int auth; | 272 | int auth; |
@@ -502,25 +504,25 @@ bool LibraryDialog::download_Etext() | |||
502 | lnk.setComment(DlglistItemTitle); | 504 | lnk.setComment(DlglistItemTitle); |
503 | 505 | ||
504 | odebug << "Filename is "+File_Name << oendl; | 506 | odebug << "Filename is "+File_Name << oendl; |
505 | lnk.setFile(File_Name); //sets File property | 507 | lnk.setFile(File_Name); //sets File property |
506 | lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D | 508 | lnk.setType("guten/plain");// hey is this a REGISTERED mime type?!?!? ;D |
507 | lnk.setExec(File_Name); | 509 | lnk.setExec(File_Name); |
508 | lnk.setIcon("gutenbrowser/Gutenbrowser"); | 510 | lnk.setIcon("gutenbrowser/Gutenbrowser"); |
509 | if(!lnk.writeLink()) { | 511 | if(!lnk.writeLink()) { |
510 | odebug << "Writing doclink did not work" << oendl; | 512 | odebug << "Writing doclink did not work" << oendl; |
511 | } else { | 513 | } else { |
512 | } | 514 | } |
513 | } else | 515 | } else |
514 | QMessageBox::message("Note","There was an error\nwith the file"); | 516 | QMessageBox::message("Note","<p>There was an error with the file</p>"); |
515 | } | 517 | } |
516 | } | 518 | } |
517 | return true; | 519 | return true; |
518 | } | 520 | } |
519 | 521 | ||
520 | bool LibraryDialog::httpDownload() | 522 | bool LibraryDialog::httpDownload() |
521 | {// httpDownload | 523 | {// httpDownload |
522 | #ifndef Q_WS_QWS | 524 | #ifndef Q_WS_QWS |
523 | Config config("Gutenbrowser"); | 525 | Config config("Gutenbrowser"); |
524 | config.setGroup( "Browser" ); | 526 | config.setGroup( "Browser" ); |
525 | QString brow = config.readEntry("Preferred", ""); | 527 | QString brow = config.readEntry("Preferred", ""); |
526 | QString file_name = "./.guten_temp"; | 528 | QString file_name = "./.guten_temp"; |
@@ -930,25 +932,25 @@ void LibraryDialog::newList() | |||
930 | onButtonDownload(); | 932 | onButtonDownload(); |
931 | } else { | 933 | } else { |
932 | Output *outDlg; | 934 | Output *outDlg; |
933 | buttonNewList->setDown(TRUE); | 935 | buttonNewList->setDown(TRUE); |
934 | QDir gutDir(QPEApplication::qpeDir()+"etc/gutenbrowser"); | 936 | QDir gutDir(QPEApplication::qpeDir()+"etc/gutenbrowser"); |
935 | if(!gutDir.exists()) gutDir.mkdir(QPEApplication::qpeDir()+"etc/gutenbrowser",true); | 937 | if(!gutDir.exists()) gutDir.mkdir(QPEApplication::qpeDir()+"etc/gutenbrowser",true); |
936 | if( chdir(QPEApplication::qpeDir()+"etc/gutenbrowser") == 0) { | 938 | if( chdir(QPEApplication::qpeDir()+"etc/gutenbrowser") == 0) { |
937 | odebug << "changing dir "+QPEApplication::qpeDir()+"etc/gutenbrowser" << oendl; | 939 | odebug << "changing dir "+QPEApplication::qpeDir()+"etc/gutenbrowser" << oendl; |
938 | QString gutenindex1 = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; | 940 | QString gutenindex1 = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; |
939 | QString cmd="wget -O " + gutenindex1 + " http://sailor.gutenberg.org/GUTINDEX.ALL 2>&1"; | 941 | QString cmd="wget -O " + gutenindex1 + " http://sailor.gutenberg.org/GUTINDEX.ALL 2>&1"; |
940 | 942 | ||
941 | int result = QMessageBox::warning( this,"Download" | 943 | int result = QMessageBox::warning( this,"Download" |
942 | ,"Ok to use /'wget/' to download\na new library list?\n" | 944 | ,"<p>Ok to use /'wget/' to download a new library list?</P>" |
943 | ,"Yes","No",0,0,1); | 945 | ,"Yes","No",0,0,1); |
944 | qApp->processEvents(); | 946 | qApp->processEvents(); |
945 | if(result == 0) { | 947 | if(result == 0) { |
946 | outDlg = new Output( 0, tr("Downloading Gutenberg Index...."),TRUE); | 948 | outDlg = new Output( 0, tr("Downloading Gutenberg Index...."),TRUE); |
947 | outDlg->showMaximized(); | 949 | outDlg->showMaximized(); |
948 | outDlg->show(); | 950 | outDlg->show(); |
949 | qApp->processEvents(); | 951 | qApp->processEvents(); |
950 | FILE *fp; | 952 | FILE *fp; |
951 | char line[130]; | 953 | char line[130]; |
952 | outDlg->OutputEdit->append( tr("Running wget") ); | 954 | outDlg->OutputEdit->append( tr("Running wget") ); |
953 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 955 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
954 | sleep(1); | 956 | sleep(1); |
@@ -1028,25 +1030,25 @@ bool LibraryDialog::moreInfo() | |||
1028 | } | 1030 | } |
1029 | item=0; | 1031 | item=0; |
1030 | if(titleString.length()>2) { | 1032 | if(titleString.length()>2) { |
1031 | odebug << "Title is "+titleString << oendl; | 1033 | odebug << "Title is "+titleString << oendl; |
1032 | titleString.replace( QRegExp("\\s"), "%20"); | 1034 | titleString.replace( QRegExp("\\s"), "%20"); |
1033 | titleString.replace( QRegExp("'"), "%20"); | 1035 | titleString.replace( QRegExp("'"), "%20"); |
1034 | titleString.replace( QRegExp("\""), "%20"); | 1036 | titleString.replace( QRegExp("\""), "%20"); |
1035 | titleString.replace( QRegExp("&"), "%20"); | 1037 | titleString.replace( QRegExp("&"), "%20"); |
1036 | QString cmd= "http://google.com/search?q="+titleString+"&num=30&sa=Google+Search"; | 1038 | QString cmd= "http://google.com/search?q="+titleString+"&num=30&sa=Google+Search"; |
1037 | cmd="opera "+cmd; | 1039 | cmd="opera "+cmd; |
1038 | system(cmd); | 1040 | system(cmd); |
1039 | } else | 1041 | } else |
1040 | QMessageBox::message( "Note","If you select a title, this will\nsearch google.com for that title."); | 1042 | QMessageBox::message( "Note","<p>If you select a title, this will search google.com for that title.</p>"); |
1041 | return true; | 1043 | return true; |
1042 | 1044 | ||
1043 | } | 1045 | } |
1044 | 1046 | ||
1045 | /* | 1047 | /* |
1046 | This loads the library Index*/ | 1048 | This loads the library Index*/ |
1047 | void LibraryDialog::FindLibrary() | 1049 | void LibraryDialog::FindLibrary() |
1048 | { | 1050 | { |
1049 | buttonLibrary->setDown(TRUE); | 1051 | buttonLibrary->setDown(TRUE); |
1050 | 1052 | ||
1051 | qApp->processEvents(); | 1053 | qApp->processEvents(); |
1052 | if( QFile( new_index).exists() /* && this->isHidden() */) { | 1054 | if( QFile( new_index).exists() /* && this->isHidden() */) { |
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp index 72d605e..60c1c75 100644 --- a/noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp +++ b/noncore/apps/opie-gutenbrowser/LibraryDialogData.cpp | |||
@@ -227,30 +227,31 @@ void LibraryDialog::initDialog(){ | |||
227 | layout6->addMultiCellWidget(checkBox, 1, 1, 0, 0); | 227 | layout6->addMultiCellWidget(checkBox, 1, 1, 0, 0); |
228 | layout6->addMultiCellWidget(sortingCombo, 2, 2, 0, 0); | 228 | layout6->addMultiCellWidget(sortingCombo, 2, 2, 0, 0); |
229 | layout6->addMultiCellWidget(authBox, 3, 3, 0, 0); | 229 | layout6->addMultiCellWidget(authBox, 3, 3, 0, 0); |
230 | 230 | ||
231 | layout->addMultiCellWidget( buttonSearch, 1, 1, 0, 0); | 231 | layout->addMultiCellWidget( buttonSearch, 1, 1, 0, 0); |
232 | layout->addMultiCellWidget( buttonLibrary, 1, 1, 1, 1); | 232 | layout->addMultiCellWidget( buttonLibrary, 1, 1, 1, 1); |
233 | layout->addMultiCellWidget( moreInfoButton, 1, 1, 2, 2); | 233 | layout->addMultiCellWidget( moreInfoButton, 1, 1, 2, 2); |
234 | layout->addMultiCellWidget( buttonNewList, 1, 1, 3, 3); | 234 | layout->addMultiCellWidget( buttonNewList, 1, 1, 3, 3); |
235 | 235 | ||
236 | moreInfoButton->setText("Info"); | 236 | moreInfoButton->setText("Info"); |
237 | moreInfoButton->setDisabled(TRUE); | 237 | moreInfoButton->setDisabled(TRUE); |
238 | buttonSearch->setDisabled(TRUE); | 238 | buttonSearch->setDisabled(TRUE); |
239 | buttonSearch->setDefault(TRUE); | ||
239 | 240 | ||
240 | buttonSearch->setText(tr("Search")); | 241 | buttonSearch->setText(tr("Search")); |
241 | 242 | ||
242 | buttonCancel->setText(tr("Close")); | 243 | buttonCancel->setText(tr("Close")); |
243 | buttonLibrary->setText("Load"); | 244 | buttonLibrary->setText("Load"); |
244 | buttonLibrary->setDefault(TRUE); | 245 | // buttonLibrary->setDefault(TRUE); |
245 | buttonNewList->setText("New List"); | 246 | buttonNewList->setText("New List"); |
246 | 247 | ||
247 | QStrList sortingList; | 248 | QStrList sortingList; |
248 | sortingList.append( "Sort by Number"); | 249 | sortingList.append( "Sort by Number"); |
249 | sortingList.append("Sort by Title"); | 250 | sortingList.append("Sort by Title"); |
250 | sortingList.append( "Sort by Author"); | 251 | sortingList.append( "Sort by Author"); |
251 | sortingList.append("Sort by Year"); | 252 | sortingList.append("Sort by Year"); |
252 | 253 | ||
253 | sortingCombo->insertStrList(sortingList,0); | 254 | sortingCombo->insertStrList(sortingList,0); |
254 | sortingCombo->setCurrentItem(2); | 255 | sortingCombo->setCurrentItem(2); |
255 | sortingCombo->setMaximumWidth(180); | 256 | sortingCombo->setMaximumWidth(180); |
256 | 257 | ||
diff --git a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp index f14080f..be920dd 100644 --- a/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp +++ b/noncore/apps/opie-gutenbrowser/gutenbrowser.cpp | |||
@@ -96,25 +96,25 @@ Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags ) | |||
96 | menu = new QHBoxLayout(-1,"menu"); | 96 | menu = new QHBoxLayout(-1,"menu"); |
97 | buttons2 = new QHBoxLayout(-1,"buttons2"); | 97 | buttons2 = new QHBoxLayout(-1,"buttons2"); |
98 | edits = new QHBoxLayout(-1,"edits"); | 98 | edits = new QHBoxLayout(-1,"edits"); |
99 | 99 | ||
100 | useSplitter=TRUE; | 100 | useSplitter=TRUE; |
101 | 101 | ||
102 | initConfig(); | 102 | initConfig(); |
103 | initMenuBar(); | 103 | initMenuBar(); |
104 | initButtonBar(); | 104 | initButtonBar(); |
105 | initStatusBar(); | 105 | initStatusBar(); |
106 | initView(); | 106 | initView(); |
107 | initSlots(); | 107 | initSlots(); |
108 | 108 | qDebug("init finished"); | |
109 | QPEApplication::setStylusOperation( mainList->viewport(),QPEApplication::RightOnHold); | 109 | QPEApplication::setStylusOperation( mainList->viewport(),QPEApplication::RightOnHold); |
110 | 110 | ||
111 | connect( mainList, SIGNAL( mouseButtonPressed( int, QListBoxItem *, const QPoint &)), | 111 | connect( mainList, SIGNAL( mouseButtonPressed( int, QListBoxItem *, const QPoint &)), |
112 | this, SLOT( mainListPressed(int, QListBoxItem *, const QPoint &)) ); | 112 | this, SLOT( mainListPressed(int, QListBoxItem *, const QPoint &)) ); |
113 | if( useIcons) | 113 | if( useIcons) |
114 | toggleButtonIcons( TRUE); | 114 | toggleButtonIcons( TRUE); |
115 | else | 115 | else |
116 | toggleButtonIcons( FALSE); | 116 | toggleButtonIcons( FALSE); |
117 | 117 | ||
118 | enableButtons(false); | 118 | enableButtons(false); |
119 | 119 | ||
120 | Config config("Gutenbrowser"); // populate menubuttonlist | 120 | Config config("Gutenbrowser"); // populate menubuttonlist |
@@ -127,48 +127,49 @@ Gutenbrowser::Gutenbrowser(QWidget *,const char*, WFlags ) | |||
127 | QString tempFileName; | 127 | QString tempFileName; |
128 | 128 | ||
129 | for (int i = 0; i <= i_numofFiles; i++) { | 129 | for (int i = 0; i <= i_numofFiles; i++) { |
130 | // tempFileName.setNum(i); | 130 | // tempFileName.setNum(i); |
131 | config.setGroup( "Files" ); | 131 | config.setGroup( "Files" ); |
132 | QString ramble = config.readEntry( QString::number(i), "" ); | 132 | QString ramble = config.readEntry( QString::number(i), "" ); |
133 | 133 | ||
134 | config.setGroup( "Titles" ); | 134 | config.setGroup( "Titles" ); |
135 | QString tempTitle = config.readEntry( ramble, ""); | 135 | QString tempTitle = config.readEntry( ramble, ""); |
136 | config.setGroup( tempTitle); | 136 | config.setGroup( tempTitle); |
137 | int index=config.readNumEntry( "LineNumber", -1 ); | 137 | int index=config.readNumEntry( "LineNumber", -1 ); |
138 | if( index != -1) { | 138 | if( index != -1) { |
139 | // odebug << tempTitle << oendl; | 139 | odebug << tempTitle << oendl; |
140 | bookmarksMenu->insertItem( tempTitle); | 140 | bookmarksMenu->insertItem( tempTitle); |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | // QString gutenIndex= local_library + "GUTINDEX.ALL"; | 144 | // QString gutenIndex= local_library + "GUTINDEX.ALL"; |
145 | QString gutenIndex= QPEApplication::qpeDir()+ "/etc/gutenbrowser/GUTINDEX.ALL"; | 145 | QString gutenIndex = QPEApplication::qpeDir()+ "/etc/gutenbrowser/GUTINDEX.ALL"; |
146 | 146 | qDebug("gutenindex "+gutenIndex ); | |
147 | if( QFile( gutenIndex).exists() ) { | 147 | if( QFile( gutenIndex).exists() ) { |
148 | indexLib.setName( gutenIndex); | 148 | indexLib.setName( gutenIndex); |
149 | } else { | 149 | } else { |
150 | QString localLibIndexFile = QPEApplication::qpeDir()+ "/etc/gutenbrowser/PGWHOLE.TXT"; | 150 | QString localLibIndexFile = QPEApplication::qpeDir()+ "/etc/gutenbrowser/PGWHOLE.TXT"; |
151 | // QString localLibIndexFile= local_library + "PGWHOLE.TXT"; | 151 | // QString localLibIndexFile= local_library + "PGWHOLE.TXT"; |
152 | newindexLib.setName( localLibIndexFile); | 152 | newindexLib.setName( localLibIndexFile); |
153 | } | 153 | } |
154 | qDebug("attempting new library"); | ||
154 | LibraryDlg = new LibraryDialog( this, "Library Index" /*, TRUE */); | 155 | LibraryDlg = new LibraryDialog( this, "Library Index" /*, TRUE */); |
155 | loadCheck=false; | 156 | loadCheck = false; |
156 | chdir(local_library); | 157 | chdir(local_library); |
157 | if(!showMainList) { | 158 | if(!showMainList) { |
158 | Lview->setFocus(); | 159 | Lview->setFocus(); |
159 | // if(firstTime) | 160 | // if(firstTime) |
160 | // Bookmark(); | 161 | // Bookmark(); |
161 | for (int i=1;i< qApp->argc();i++) { | 162 | for (int i=1;i< qApp->argc();i++) { |
162 | odebug << "Suppose we open somethin" << oendl; | 163 | qDebug("Suppose we open somethin"); |
163 | load(qApp->argv()[i]); | 164 | load(qApp->argv()[i]); |
164 | } | 165 | } |
165 | } else { | 166 | } else { |
166 | fillWithTitles(); | 167 | fillWithTitles(); |
167 | mainList->setFocus(); | 168 | mainList->setFocus(); |
168 | // mainList->setCurrentItem(0); | 169 | // mainList->setCurrentItem(0); |
169 | 170 | ||
170 | } | 171 | } |
171 | writeConfig(); | 172 | writeConfig(); |
172 | } //end init | 173 | } //end init |
173 | 174 | ||
174 | Gutenbrowser::~Gutenbrowser() { | 175 | Gutenbrowser::~Gutenbrowser() { |
@@ -219,29 +220,29 @@ void Gutenbrowser::goGetit( const QString &url, bool showMsg) { | |||
219 | odebug << "Issuing the system command: " << cmd << "" << oendl; | 220 | odebug << "Issuing the system command: " << cmd << "" << oendl; |
220 | 221 | ||
221 | Output *outDlg; | 222 | Output *outDlg; |
222 | outDlg = new Output(this, tr("Gutenbrowser Output"),FALSE); | 223 | outDlg = new Output(this, tr("Gutenbrowser Output"),FALSE); |
223 | outDlg->showMaximized(); | 224 | outDlg->showMaximized(); |
224 | outDlg->show(); | 225 | outDlg->show(); |
225 | qApp->processEvents(); | 226 | qApp->processEvents(); |
226 | FILE *fp; | 227 | FILE *fp; |
227 | char line[130]; | 228 | char line[130]; |
228 | outDlg->OutputEdit->append( tr("Running wget") ); | 229 | outDlg->OutputEdit->append( tr("Running wget") ); |
229 | sleep(1); | 230 | sleep(1); |
230 | fp = popen( (const char *) cmd, "r"); | 231 | fp = popen( (const char *) cmd, "r"); |
231 | // odebug << "Issuing the command\n"+cmd << oendl; | 232 | odebug << "Issuing the command\n"+cmd << oendl; |
232 | // system(cmd); | 233 | // system(cmd); |
233 | while ( fgets( line, sizeof line, fp)) { | 234 | while ( fgets( line, sizeof line, fp)) { |
234 | outDlg->OutputEdit->append(line); | 235 | outDlg->OutputEdit->append(line); |
235 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 236 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
236 | } | 237 | } |
237 | pclose(fp); | 238 | pclose(fp); |
238 | outDlg->close(); | 239 | outDlg->close(); |
239 | if(outDlg) | 240 | if(outDlg) |
240 | delete outDlg; | 241 | delete outDlg; |
241 | } else { | 242 | } else { |
242 | if( brow == "Konq") { | 243 | if( brow == "Konq") { |
243 | cmd = "konqueror "+url+" &"; | 244 | cmd = "konqueror "+url+" &"; |
244 | } | 245 | } |
245 | if( brow == "Opera") { //for desktop testing | 246 | if( brow == "Opera") { //for desktop testing |
246 | cmd = "opera "+url+" &"; | 247 | cmd = "opera "+url+" &"; |
247 | } | 248 | } |
@@ -400,74 +401,74 @@ void Gutenbrowser::ForwardBtn() { | |||
400 | 401 | ||
401 | QString s; | 402 | QString s; |
402 | QString insertString; | 403 | QString insertString; |
403 | int pageSize= Lview->PageSize(); | 404 | int pageSize= Lview->PageSize(); |
404 | Lview->clear(); | 405 | Lview->clear(); |
405 | 406 | ||
406 | for(int fd=0; fd < pageSize - 1;fd++) { | 407 | for(int fd=0; fd < pageSize - 1;fd++) { |
407 | f.readLine(s, 256); | 408 | f.readLine(s, 256); |
408 | if(useWrap) | 409 | if(useWrap) |
409 | s.replace(QRegExp("\n"),""); | 410 | s.replace(QRegExp("\n"),""); |
410 | insertString+=s; | 411 | insertString+=s; |
411 | Lview->insertLine( s, -1); | 412 | Lview->insertLine( s, -1); |
412 | // odebug << s << oendl; | 413 | odebug << s << oendl; |
413 | currentLine++; | 414 | currentLine++; |
414 | } | 415 | } |
415 | // Lview->insertAt( insertString,0,0, FALSE); | 416 | // Lview->insertAt( insertString,0,0, FALSE); |
416 | currentFilePos = f.at(); | 417 | currentFilePos = f.at(); |
417 | // if( i_pageNum != pages) { | 418 | // if( i_pageNum != pages) { |
418 | // Lview->MultiLine_Ex::pageDown( FALSE); | 419 | // Lview->MultiLine_Ex::pageDown( FALSE); |
419 | i_pageNum++; | 420 | i_pageNum++; |
420 | pageStopArray.resize(i_pageNum + 1); | 421 | pageStopArray.resize(i_pageNum + 1); |
421 | // int length = Lview->length(); | 422 | // int length = Lview->length(); |
422 | 423 | ||
423 | pageStopArray[i_pageNum ] = currentFilePos; | 424 | pageStopArray[i_pageNum ] = currentFilePos; |
424 | // odebug << currentFilePos << " current page is number " << i_pageNum | 425 | odebug << currentFilePos << " current page is number " << i_pageNum |
425 | // << ", pagesize " << pageSize << ", length " << Lview->length() | 426 | << ", pagesize " << pageSize << ", length " << Lview->length() |
426 | // << ", current " << pageStopArray[i_pageNum] << oendl; | 427 | << ", current " << pageStopArray[i_pageNum] << oendl; |
427 | setStatus(); | 428 | setStatus(); |
428 | Lview->setCursorPosition( 0, 0, FALSE); | 429 | // Lview->setCursorPosition( 0, 0, FALSE); |
429 | // } | 430 | // } |
430 | 431 | ||
431 | } else { | 432 | } else { |
432 | // odebug << "bal" << oendl; | 433 | odebug << "bal" << oendl; |
433 | // if( i_pageNum != pages) { | 434 | // if( i_pageNum != pages) { |
434 | 435 | ||
435 | // // int newTop = Lview->Top(); | 436 | // // int newTop = Lview->Top(); |
436 | // // if(Lview->lastRow() > i) | 437 | // // if(Lview->lastRow() > i) |
437 | // Lview->ScrollUp(1); | 438 | // Lview->ScrollUp(1); |
438 | // // i_pageNum++; | 439 | // // i_pageNum++; |
439 | // setStatus(); | 440 | // setStatus(); |
440 | // Lview->setCursorPosition( Lview->Top(), 0, FALSE); | 441 | // Lview->setCursorPosition( Lview->Top(), 0, FALSE); |
441 | 442 | ||
442 | // } | 443 | // } |
443 | 444 | ||
444 | } | 445 | } |
445 | Lview->setFocus(); | 446 | Lview->setFocus(); |
446 | 447 | ||
447 | // odebug << "page number " << i_pageNum << " line number " << currentLine << "" << oendl; | 448 | odebug << "page number " << i_pageNum << " line number " << currentLine << "" << oendl; |
448 | } | 449 | } |
449 | 450 | ||
450 | 451 | ||
451 | void Gutenbrowser::BackBtn() { | 452 | void Gutenbrowser::BackBtn() { |
452 | if( i_pageNum > 0) { | 453 | if( i_pageNum > 0) { |
453 | int pageSize= Lview->PageSize(); | 454 | int pageSize= Lview->PageSize(); |
454 | // int length=Lview->length(); | 455 | // int length=Lview->length(); |
455 | 456 | ||
456 | i_pageNum--; | 457 | i_pageNum--; |
457 | currentFilePos = f.at(); | 458 | currentFilePos = f.at(); |
458 | 459 | ||
459 | // odebug << currentFilePos << " move back to " << pageStopArray[i_pageNum - 1 ] | 460 | odebug << currentFilePos << " move back to " << pageStopArray[i_pageNum - 1 ] |
460 | // << ", current page number " << i_pageNum | 461 | << ", current page number " << i_pageNum |
461 | // << ", " << pageSize << ", length " << Lview->length() << oendl; | 462 | << ", " << pageSize << ", length " << Lview->length() << oendl; |
462 | 463 | ||
463 | if( i_pageNum < 2) { | 464 | if( i_pageNum < 2) { |
464 | f.at( 0); | 465 | f.at( 0); |
465 | } else { | 466 | } else { |
466 | if(!f.at( pageStopArray[i_pageNum - 1] )) | 467 | if(!f.at( pageStopArray[i_pageNum - 1] )) |
467 | odebug << "File positioned backward did not work" << oendl; | 468 | odebug << "File positioned backward did not work" << oendl; |
468 | } | 469 | } |
469 | QString s; | 470 | QString s; |
470 | // int sizeLine=0; | 471 | // int sizeLine=0; |
471 | Lview->clear(); | 472 | Lview->clear(); |
472 | // QString insertString; | 473 | // QString insertString; |
473 | 474 | ||
@@ -492,25 +493,25 @@ void Gutenbrowser::BackBtn() { | |||
492 | if( i_pageNum < 1) | 493 | if( i_pageNum < 1) |
493 | i_pageNum = 1; | 494 | i_pageNum = 1; |
494 | setCaption(QString::number(i_pageNum)); | 495 | setCaption(QString::number(i_pageNum)); |
495 | } else { | 496 | } else { |
496 | // int newTop = Lview->Top(); | 497 | // int newTop = Lview->Top(); |
497 | // if(Lview->lastRow() > i) | 498 | // if(Lview->lastRow() > i) |
498 | Lview->MultiLine_Ex::pageUp( FALSE); | 499 | Lview->MultiLine_Ex::pageUp( FALSE); |
499 | // Lview->ScrollDown(1); | 500 | // Lview->ScrollDown(1); |
500 | // i_pageNum--; | 501 | // i_pageNum--; |
501 | if( i_pageNum < 1) | 502 | if( i_pageNum < 1) |
502 | i_pageNum = 1; | 503 | i_pageNum = 1; |
503 | setStatus(); | 504 | setStatus(); |
504 | Lview->setCursorPosition( Lview->Top(), 0, FALSE); | 505 | // Lview->setCursorPosition( Lview->Top(), 0, FALSE); |
505 | 506 | ||
506 | } | 507 | } |
507 | } | 508 | } |
508 | Lview->setFocus(); | 509 | Lview->setFocus(); |
509 | } | 510 | } |
510 | 511 | ||
511 | void Gutenbrowser::doBeginBtn() { | 512 | void Gutenbrowser::doBeginBtn() { |
512 | if(loadCheck) { | 513 | if(loadCheck) { |
513 | qApp->processEvents(); | 514 | qApp->processEvents(); |
514 | BeginBtn(); | 515 | BeginBtn(); |
515 | } | 516 | } |
516 | } | 517 | } |
@@ -526,25 +527,25 @@ void Gutenbrowser::TopBtn() { | |||
526 | i_pageNum = 1; | 527 | i_pageNum = 1; |
527 | int pageSize = Lview->PageSize() ; | 528 | int pageSize = Lview->PageSize() ; |
528 | Lview->clear(); | 529 | Lview->clear(); |
529 | QString s; | 530 | QString s; |
530 | f.at(0); | 531 | f.at(0); |
531 | for(int fd=0; fd < pageSize ;fd++) { | 532 | for(int fd=0; fd < pageSize ;fd++) { |
532 | f.readLine(s, 256); | 533 | f.readLine(s, 256); |
533 | if(useWrap) | 534 | if(useWrap) |
534 | s.replace(QRegExp("\n"),""); | 535 | s.replace(QRegExp("\n"),""); |
535 | Lview->insertLine(s ,-1); | 536 | Lview->insertLine(s ,-1); |
536 | currentLine++; | 537 | currentLine++; |
537 | } | 538 | } |
538 | Lview->setCursorPosition( 0,0, FALSE); | 539 | // Lview->setCursorPosition( 0,0, FALSE); |
539 | i_pageNum=1; | 540 | i_pageNum=1; |
540 | setStatus(); | 541 | setStatus(); |
541 | } | 542 | } |
542 | Lview->setFocus(); | 543 | Lview->setFocus(); |
543 | } | 544 | } |
544 | } | 545 | } |
545 | 546 | ||
546 | //moves text to the start of the EText | 547 | //moves text to the start of the EText |
547 | void Gutenbrowser::BeginBtn() { | 548 | void Gutenbrowser::BeginBtn() { |
548 | i_pageNum = 1; | 549 | i_pageNum = 1; |
549 | currentLine = 0; | 550 | currentLine = 0; |
550 | QString s_pattern="*END*THE SMALL PRINT"; | 551 | QString s_pattern="*END*THE SMALL PRINT"; |
@@ -569,25 +570,25 @@ void Gutenbrowser::BeginBtn() { | |||
569 | f.at( 0); | 570 | f.at( 0); |
570 | 571 | ||
571 | while ( !f.atEnd() ) { | 572 | while ( !f.atEnd() ) { |
572 | f.readLine(s, 256); | 573 | f.readLine(s, 256); |
573 | lineNo++; | 574 | lineNo++; |
574 | LeftText = s; | 575 | LeftText = s; |
575 | currentFilePos = f.at(); | 576 | currentFilePos = f.at(); |
576 | 577 | ||
577 | i_pageNum = lineNo/pageSize; | 578 | i_pageNum = lineNo/pageSize; |
578 | if(lastPage < i_pageNum) { | 579 | if(lastPage < i_pageNum) { |
579 | pageStopArray.resize(i_pageNum + 1); | 580 | pageStopArray.resize(i_pageNum + 1); |
580 | pageStopArray[i_pageNum ] = currentFilePos; | 581 | pageStopArray[i_pageNum ] = currentFilePos; |
581 | // odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; | 582 | odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; |
582 | } | 583 | } |
583 | // lastPage = i_pageNum; | 584 | // lastPage = i_pageNum; |
584 | if( LeftText.find( s_pattern, 0 , TRUE) != -1 || LeftText.find( sPattern2, 0 , TRUE) != -1 ) { | 585 | if( LeftText.find( s_pattern, 0 , TRUE) != -1 || LeftText.find( sPattern2, 0 , TRUE) != -1 ) { |
585 | odebug << "<<<<<< FOUND IT!! new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; | 586 | odebug << "<<<<<< FOUND IT!! new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; |
586 | break; | 587 | break; |
587 | } | 588 | } |
588 | } | 589 | } |
589 | if(f.atEnd()) //in case we didnt find anything, we need to show something | 590 | if(f.atEnd()) //in case we didnt find anything, we need to show something |
590 | f.at(0); | 591 | f.at(0); |
591 | Lview->clear(); | 592 | Lview->clear(); |
592 | for(int fd=0; fd < pageSize - 1;fd++) { | 593 | for(int fd=0; fd < pageSize - 1;fd++) { |
593 | f.readLine(s, 256); | 594 | f.readLine(s, 256); |
@@ -595,27 +596,27 @@ void Gutenbrowser::BeginBtn() { | |||
595 | s.replace(QRegExp("\n"),""); | 596 | s.replace(QRegExp("\n"),""); |
596 | Lview->insertLine( s, -1); | 597 | Lview->insertLine( s, -1); |
597 | currentLine++; | 598 | currentLine++; |
598 | } | 599 | } |
599 | 600 | ||
600 | i_pageNum = lineNo/pageSize; | 601 | i_pageNum = lineNo/pageSize; |
601 | pageStopArray.resize(i_pageNum + 1); | 602 | pageStopArray.resize(i_pageNum + 1); |
602 | // int length = Lview->length(); | 603 | // int length = Lview->length(); |
603 | 604 | ||
604 | qApp->processEvents(); | 605 | qApp->processEvents(); |
605 | 606 | ||
606 | if( pos > i_topRow ) { | 607 | if( pos > i_topRow ) { |
607 | Lview->setCursorPosition( pos+linesPerPage+2/* - i_topRow+3 */,0, FALSE); | 608 | // Lview->setCursorPosition( pos+linesPerPage+2/* - i_topRow+3 */,0, FALSE); |
608 | } else { | 609 | } else { |
609 | Lview->setCursorPosition( pos+2 , 0, FALSE ); | 610 | // Lview->setCursorPosition( pos+2 , 0, FALSE ); |
610 | } | 611 | } |
611 | 612 | ||
612 | Lview->deselect(); | 613 | Lview->deselect(); |
613 | // AdjustStatus(); | 614 | // AdjustStatus(); |
614 | Lview->setFocus(); | 615 | Lview->setFocus(); |
615 | } | 616 | } |
616 | 617 | ||
617 | /* | 618 | /* |
618 | sets the current page and place as a bookmark*/ | 619 | sets the current page and place as a bookmark*/ |
619 | void Gutenbrowser::setBookmark() { | 620 | void Gutenbrowser::setBookmark() { |
620 | int eexit=QMessageBox::information(this, "Note", | 621 | int eexit=QMessageBox::information(this, "Note", |
621 | "Do you really want to \nset this bookmark?." | 622 | "Do you really want to \nset this bookmark?." |
@@ -652,25 +653,25 @@ void Gutenbrowser::setBookmark() { | |||
652 | bookmarksMenu->insertItem( title); | 653 | bookmarksMenu->insertItem( title); |
653 | } | 654 | } |
654 | } //end setBookmark | 655 | } //end setBookmark |
655 | 656 | ||
656 | 657 | ||
657 | /* goes to last set bookmark*/ | 658 | /* goes to last set bookmark*/ |
658 | void Gutenbrowser::Bookmark( int itemId) { | 659 | void Gutenbrowser::Bookmark( int itemId) { |
659 | 660 | ||
660 | // qApp->processEvents(); | 661 | // qApp->processEvents(); |
661 | Config config("Gutenbrowser"); | 662 | Config config("Gutenbrowser"); |
662 | config.setGroup( "Bookmarks" ); | 663 | config.setGroup( "Bookmarks" ); |
663 | 664 | ||
664 | // odebug << "<<<<<< " << Lview->PageSize() << ", " << Lview->lastRow() - Lview->topRow() << "" << oendl; | 665 | odebug << "<<<<<< " << Lview->PageSize() << ", " << Lview->lastRow() - Lview->topRow() << "" << oendl; |
665 | 666 | ||
666 | QString itemString; | 667 | QString itemString; |
667 | 668 | ||
668 | odebug << "menu item " << itemId << "" << oendl; | 669 | odebug << "menu item " << itemId << "" << oendl; |
669 | QString tempTitle; | 670 | QString tempTitle; |
670 | QString s_Bmrkrow; | 671 | QString s_Bmrkrow; |
671 | QString s_pageNum; | 672 | QString s_pageNum; |
672 | int Bmrkrow=0; | 673 | int Bmrkrow=0; |
673 | int bookmarkPosition = 0; | 674 | int bookmarkPosition = 0; |
674 | 675 | ||
675 | // qApp->processEvents(); | 676 | // qApp->processEvents(); |
676 | config.setGroup( "Bookmarks" ); | 677 | config.setGroup( "Bookmarks" ); |
@@ -698,25 +699,25 @@ void Gutenbrowser::Bookmark( int itemId) { | |||
698 | QString s; | 699 | QString s; |
699 | int lineNo=0; | 700 | int lineNo=0; |
700 | int lastPage=1; | 701 | int lastPage=1; |
701 | while ( !f.atEnd() ) { | 702 | while ( !f.atEnd() ) { |
702 | f.readLine(s, 256); | 703 | f.readLine(s, 256); |
703 | lineNo++; | 704 | lineNo++; |
704 | currentFilePos = f.at(); | 705 | currentFilePos = f.at(); |
705 | 706 | ||
706 | i_pageNum = lineNo/pageSize; | 707 | i_pageNum = lineNo/pageSize; |
707 | if(lastPage < i_pageNum) { | 708 | if(lastPage < i_pageNum) { |
708 | pageStopArray.resize(i_pageNum + 1); | 709 | pageStopArray.resize(i_pageNum + 1); |
709 | pageStopArray[i_pageNum ] = currentFilePos; | 710 | pageStopArray[i_pageNum ] = currentFilePos; |
710 | // odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; | 711 | odebug << "new page number " << i_pageNum << ", found at " << currentFilePos << "" << oendl; |
711 | } | 712 | } |
712 | if(currentFilePos == bookmarkPosition) | 713 | if(currentFilePos == bookmarkPosition) |
713 | break; | 714 | break; |
714 | } | 715 | } |
715 | if(f.atEnd()) | 716 | if(f.atEnd()) |
716 | f.at(0); | 717 | f.at(0); |
717 | else | 718 | else |
718 | f.at( bookmarkPosition); | 719 | f.at( bookmarkPosition); |
719 | 720 | ||
720 | for(int fd=0; fd < pageSize - 1;fd++) { | 721 | for(int fd=0; fd < pageSize - 1;fd++) { |
721 | f.readLine(s, 256); | 722 | f.readLine(s, 256); |
722 | lineNo++; | 723 | lineNo++; |
@@ -735,25 +736,25 @@ void Gutenbrowser::Bookmark( int itemId) { | |||
735 | Lview->show(); | 736 | Lview->show(); |
736 | // qApp->processEvents(); | 737 | // qApp->processEvents(); |
737 | } | 738 | } |
738 | 739 | ||
739 | odebug << "bookmark loaded" << oendl; | 740 | odebug << "bookmark loaded" << oendl; |
740 | setCaption(title); | 741 | setCaption(title); |
741 | } | 742 | } |
742 | 743 | ||
743 | 744 | ||
744 | bool Gutenbrowser::load( const char *fileName) { | 745 | bool Gutenbrowser::load( const char *fileName) { |
745 | 746 | ||
746 | // QCopEnvelope ( "QPE/System", "busy()" ); | 747 | // QCopEnvelope ( "QPE/System", "busy()" ); |
747 | // odebug << "Title is already set as "+title << oendl; | 748 | odebug << "Title is already set as "+title << oendl; |
748 | odebug << "sizeHint " << sizeHint().height() << " pageSize " << Lview->PageSize() << "" << oendl; | 749 | odebug << "sizeHint " << sizeHint().height() << " pageSize " << Lview->PageSize() << "" << oendl; |
749 | if( Lview->PageSize() < 4) { | 750 | if( Lview->PageSize() < 4) { |
750 | 751 | ||
751 | Lview->setMaximumHeight( sizeHint().height() ); | 752 | Lview->setMaximumHeight( sizeHint().height() ); |
752 | Lview->setMinimumHeight( sizeHint().height() ); | 753 | Lview->setMinimumHeight( sizeHint().height() ); |
753 | pointSize = Lview->fontInfo().pointSize(); | 754 | pointSize = Lview->fontInfo().pointSize(); |
754 | odebug << "sizeHint " << sizeHint().height() << " point size " << pointSize << "" << oendl; | 755 | odebug << "sizeHint " << sizeHint().height() << " point size " << pointSize << "" << oendl; |
755 | if(pointSize < 10) | 756 | if(pointSize < 10) |
756 | Lview->setFixedVisibleLines(19); | 757 | Lview->setFixedVisibleLines(19); |
757 | else | 758 | else |
758 | Lview->setFixedVisibleLines( ( (sizeHint().height() / pointSize ) * 2) -2); | 759 | Lview->setFixedVisibleLines( ( (sizeHint().height() / pointSize ) * 2) -2); |
759 | } | 760 | } |
@@ -801,25 +802,25 @@ bool Gutenbrowser::load( const char *fileName) { | |||
801 | 802 | ||
802 | pageStopArray[1] = currentFilePos; | 803 | pageStopArray[1] = currentFilePos; |
803 | 804 | ||
804 | odebug << "<<<<<<<<<<<" << currentFilePos << " current page is number " << i_pageNum | 805 | odebug << "<<<<<<<<<<<" << currentFilePos << " current page is number " << i_pageNum |
805 | << ", length " << Lview->length() << ", current " << pageStopArray[i_pageNum] | 806 | << ", length " << Lview->length() << ", current " << pageStopArray[i_pageNum] |
806 | << ", pageSize " << Lview->PageSize() << oendl; | 807 | << ", pageSize " << Lview->PageSize() << oendl; |
807 | 808 | ||
808 | Lview->setMaxLines(Lview->PageSize()*2); | 809 | Lview->setMaxLines(Lview->PageSize()*2); |
809 | odebug << "Gulped " << currentLine << "" << oendl; | 810 | odebug << "Gulped " << currentLine << "" << oendl; |
810 | setCaption(title); | 811 | setCaption(title); |
811 | Lview->setAutoUpdate( TRUE); | 812 | Lview->setAutoUpdate( TRUE); |
812 | 813 | ||
813 | Lview->setCursorPosition(0,0,FALSE); | 814 | // Lview->setCursorPosition(0,0,FALSE); |
814 | 815 | ||
815 | // pages = (int)(( Lview->numLines() / Lview->editSize() ) / 2 ) +1; | 816 | // pages = (int)(( Lview->numLines() / Lview->editSize() ) / 2 ) +1; |
816 | //odebug << "number of pages " << pages << "" << oendl; | 817 | //odebug << "number of pages " << pages << "" << oendl; |
817 | 818 | ||
818 | loadCheck = true; | 819 | loadCheck = true; |
819 | enableButtons(true); | 820 | enableButtons(true); |
820 | if( donateMenu->count() == 3) { | 821 | if( donateMenu->count() == 3) { |
821 | donateMenu->insertItem("Current Title", this, SLOT( InfoBarClick() )); | 822 | donateMenu->insertItem("Current Title", this, SLOT( InfoBarClick() )); |
822 | } | 823 | } |
823 | Lview->setFocus(); | 824 | Lview->setFocus(); |
824 | 825 | ||
825 | // QCopEnvelope("QPE/System", "notBusy()" ); | 826 | // QCopEnvelope("QPE/System", "notBusy()" ); |
@@ -892,74 +893,74 @@ int Gutenbrowser::doSearch( const QString &s_pattern , bool case_sensitive, boo | |||
892 | int i, length; | 893 | int i, length; |
893 | int pos = -1; | 894 | int pos = -1; |
894 | if(forward) { | 895 | if(forward) { |
895 | QString string; | 896 | QString string; |
896 | for(i = line; i < Lview->numLines(); i++) { | 897 | for(i = line; i < Lview->numLines(); i++) { |
897 | 898 | ||
898 | string = Lview->textLine(i); | 899 | string = Lview->textLine(i); |
899 | pos = string.find(s_pattern, i == line ? col : 0, case_sensitive); | 900 | pos = string.find(s_pattern, i == line ? col : 0, case_sensitive); |
900 | if( pos != -1) { | 901 | if( pos != -1) { |
901 | int top = Lview->Top(); | 902 | int top = Lview->Top(); |
902 | length = s_pattern.length(); | 903 | length = s_pattern.length(); |
903 | if( i > Lview->lastRow() ) { | 904 | if( i > Lview->lastRow() ) { |
904 | Lview->setCursorPosition(i,pos,FALSE); | 905 | // Lview->setCursorPosition(i,pos,FALSE); |
905 | for(int l = 0 ; l < length; l++) { | 906 | for(int l = 0 ; l < length; l++) { |
906 | Lview->cursorRight(TRUE); | 907 | Lview->cursorRight(TRUE); |
907 | } | 908 | } |
908 | Lview->setCursorPosition( i , pos + length, TRUE ); | 909 | // Lview->setCursorPosition( i , pos + length, TRUE ); |
909 | int newTop = Lview->Top(); | 910 | int newTop = Lview->Top(); |
910 | if(Lview->lastRow() > i) | 911 | if(Lview->lastRow() > i) |
911 | Lview->ScrollUp( newTop - top); | 912 | Lview->ScrollUp( newTop - top); |
912 | // AdjustStatus(); | 913 | // AdjustStatus(); |
913 | } else { | 914 | } else { |
914 | Lview->setCursorPosition(i,pos,FALSE); | 915 | // Lview->setCursorPosition(i,pos,FALSE); |
915 | for(int l = 0 ; l < length; l++) { | 916 | for(int l = 0 ; l < length; l++) { |
916 | Lview->cursorRight(TRUE); | 917 | Lview->cursorRight(TRUE); |
917 | } | 918 | } |
918 | Lview->setCursorPosition( i , pos + length, TRUE ); | 919 | // Lview->setCursorPosition( i , pos + length, TRUE ); |
919 | // AdjustStatus(); | 920 | // AdjustStatus(); |
920 | } | 921 | } |
921 | pattern = s_pattern; | 922 | pattern = s_pattern; |
922 | last_search = 1; //FORWARD; | 923 | last_search = 1; //FORWARD; |
923 | return 1; | 924 | return 1; |
924 | } | 925 | } |
925 | } | 926 | } |
926 | } else { //////////////// searching backwards | 927 | } else { //////////////// searching backwards |
927 | QString string; | 928 | QString string; |
928 | for( i = line; i >= 0; i--) { | 929 | for( i = line; i >= 0; i--) { |
929 | string = Lview->textLine(i); | 930 | string = Lview->textLine(i); |
930 | int line_length = string.length(); | 931 | int line_length = string.length(); |
931 | pos = string.findRev(s_pattern, line == i ? col : line_length , case_sensitive); | 932 | pos = string.findRev(s_pattern, line == i ? col : line_length , case_sensitive); |
932 | if (pos != -1) { | 933 | if (pos != -1) { |
933 | // int top = Lview->Top(); | 934 | // int top = Lview->Top(); |
934 | length = s_pattern.length(); | 935 | length = s_pattern.length(); |
935 | if( i < Lview->Top() ) { | 936 | if( i < Lview->Top() ) { |
936 | Lview->ScrollDown( Lview->PageSize() ); | 937 | Lview->ScrollDown( Lview->PageSize() ); |
937 | Lview->MultiLine_Ex::pageUp( FALSE ); | 938 | Lview->MultiLine_Ex::pageUp( FALSE ); |
938 | if( ! (line == i && pos > col ) ) { | 939 | if( ! (line == i && pos > col ) ) { |
939 | Lview->setCursorPosition( i ,pos ,FALSE ); | 940 | // Lview->setCursorPosition( i ,pos ,FALSE ); |
940 | for(int l = 0 ; l < length; l++) { | 941 | for(int l = 0 ; l < length; l++) { |
941 | Lview->cursorRight(TRUE); | 942 | Lview->cursorRight(TRUE); |
942 | } | 943 | } |
943 | Lview->setCursorPosition(i ,pos + length ,TRUE ); | 944 | // Lview->setCursorPosition(i ,pos + length ,TRUE ); |
944 | // int newTop = Lview->Top(); | 945 | // int newTop = Lview->Top(); |
945 | /* if(useSplitter) Rview->ScrollUp( newTop - top); | 946 | /* if(useSplitter) Rview->ScrollUp( newTop - top); |
946 | */ } | 947 | */ } |
947 | } else { | 948 | } else { |
948 | if( ! (line == i && pos > col ) ) { | 949 | if( ! (line == i && pos > col ) ) { |
949 | Lview->setCursorPosition( i, pos, FALSE ); | 950 | // Lview->setCursorPosition( i, pos, FALSE ); |
950 | for( int l = 0 ; l < length; l++) { | 951 | for( int l = 0 ; l < length; l++) { |
951 | Lview->cursorRight( TRUE); | 952 | Lview->cursorRight( TRUE); |
952 | } | 953 | } |
953 | Lview->setCursorPosition( i, pos + length, TRUE ); | 954 | // Lview->setCursorPosition( i, pos + length, TRUE ); |
954 | } | 955 | } |
955 | pattern = s_pattern; | 956 | pattern = s_pattern; |
956 | last_search = -1; | 957 | last_search = -1; |
957 | return 1; | 958 | return 1; |
958 | } | 959 | } |
959 | } | 960 | } |
960 | } | 961 | } |
961 | } | 962 | } |
962 | return 0; | 963 | return 0; |
963 | } | 964 | } |
964 | 965 | ||
965 | void Gutenbrowser::LibraryBtn() { | 966 | void Gutenbrowser::LibraryBtn() { |
@@ -971,30 +972,25 @@ void Gutenbrowser::LibraryBtn() { | |||
971 | // odebug << "newestLibraryFile is " << newestLibraryFile << " " << oendl; | 972 | // odebug << "newestLibraryFile is " << newestLibraryFile << " " << oendl; |
972 | if( QFile::exists( local_library+newestLibraryFile)) { | 973 | if( QFile::exists( local_library+newestLibraryFile)) { |
973 | if( QFile::exists(zipFile) ) { | 974 | if( QFile::exists(zipFile) ) { |
974 | UnZipIt(newestLibraryFile); | 975 | UnZipIt(newestLibraryFile); |
975 | } | 976 | } |
976 | else | 977 | else |
977 | QMessageBox::message( "Note",( tr("Please install unzip")) ); | 978 | QMessageBox::message( "Note",( tr("Please install unzip")) ); |
978 | } | 979 | } |
979 | // LibraryDlg = new LibraryDialog( this, "Library Index"); | 980 | // LibraryDlg = new LibraryDialog( this, "Library Index"); |
980 | LibraryDlg->setCaption( tr( "Gutenberg Library")); | 981 | LibraryDlg->setCaption( tr( "Gutenberg Library")); |
981 | Config config("Gutenbrowser"); | 982 | Config config("Gutenbrowser"); |
982 | config.setGroup("General"); | 983 | config.setGroup("General"); |
983 | QString tmp=config.readEntry("RunBefore","FALSE"); | 984 | |
984 | if(tmp=="FALSE") { | ||
985 | QMessageBox::message( "Note", | ||
986 | "<P>Your first time running gutenbrowser. You'll need to click the \"load library\" button to load the gutenberg index.</P>"); | ||
987 | config.writeEntry("RunBefore","TRUE"); | ||
988 | } | ||
989 | if(useSplitter) | 985 | if(useSplitter) |
990 | LibraryDlg->useSmallInterface=FALSE; | 986 | LibraryDlg->useSmallInterface=FALSE; |
991 | 987 | ||
992 | LibraryDlg->showMaximized(); | 988 | LibraryDlg->showMaximized(); |
993 | 989 | ||
994 | if( LibraryDlg->exec() != 0 ) { | 990 | if( LibraryDlg->exec() != 0 ) { |
995 | listItemNumber = LibraryDlg->DlglistItemNumber; | 991 | listItemNumber = LibraryDlg->DlglistItemNumber; |
996 | listItemFile = LibraryDlg->DlglistItemFile; | 992 | listItemFile = LibraryDlg->DlglistItemFile; |
997 | listItemYear = LibraryDlg->DlglistItemYear; | 993 | listItemYear = LibraryDlg->DlglistItemYear; |
998 | listItemTitle = LibraryDlg->DlglistItemTitle; | 994 | listItemTitle = LibraryDlg->DlglistItemTitle; |
999 | file_name = LibraryDlg->File_Name; | 995 | file_name = LibraryDlg->File_Name; |
1000 | // odebug << "title is being set as "+title << oendl; | 996 | // odebug << "title is being set as "+title << oendl; |
@@ -1781,30 +1777,30 @@ void Gutenbrowser::listClickedSlot( QListBoxItem * index) { | |||
1781 | config.setGroup( "Files" ); | 1777 | config.setGroup( "Files" ); |
1782 | QString file = config.readEntry(temp, ""); | 1778 | QString file = config.readEntry(temp, ""); |
1783 | odebug << "About to load" << oendl; | 1779 | odebug << "About to load" << oendl; |
1784 | if( Lview->isVisible()) | 1780 | if( Lview->isVisible()) |
1785 | load(file); | 1781 | load(file); |
1786 | 1782 | ||
1787 | config.setGroup( title); | 1783 | config.setGroup( title); |
1788 | file_name = config.readEntry("File Name", ""); | 1784 | file_name = config.readEntry("File Name", ""); |
1789 | i_pageNum = config.readNumEntry("Page Number", 1); | 1785 | i_pageNum = config.readNumEntry("Page Number", 1); |
1790 | int Bmrkrow = config.readNumEntry("LineNumber", -1); | 1786 | int Bmrkrow = config.readNumEntry("LineNumber", -1); |
1791 | if(Bmrkrow > -1) { | 1787 | if(Bmrkrow > -1) { |
1792 | if( Bmrkrow > Lview->topRow() ) { | 1788 | if( Bmrkrow > Lview->topRow() ) { |
1793 | Lview->setCursorPosition( Bmrkrow /* - Lview->topRow() */,0, FALSE ); | 1789 | // Lview->setCursorPosition( Bmrkrow /* - Lview->topRow() */,0, FALSE ); |
1794 | Lview->ScrollUp( Bmrkrow - Lview->topRow() ); | 1790 | Lview->ScrollUp( Bmrkrow - Lview->topRow() ); |
1795 | // AdjustStatus(); | 1791 | // AdjustStatus(); |
1796 | } | 1792 | } |
1797 | else if( Bmrkrow < Lview->topRow() ) { | 1793 | else if( Bmrkrow < Lview->topRow() ) { |
1798 | Lview->setCursorPosition( Lview->topRow() - Bmrkrow ,0, FALSE ); | 1794 | // Lview->setCursorPosition( Lview->topRow() - Bmrkrow ,0, FALSE ); |
1799 | Lview->ScrollDown( Lview->topRow() - Bmrkrow ); | 1795 | Lview->ScrollDown( Lview->topRow() - Bmrkrow ); |
1800 | // AdjustStatus(); | 1796 | // AdjustStatus(); |
1801 | } | 1797 | } |
1802 | } | 1798 | } |
1803 | } | 1799 | } |
1804 | } | 1800 | } |
1805 | 1801 | ||
1806 | void Gutenbrowser::infoGutenbrowser() { | 1802 | void Gutenbrowser::infoGutenbrowser() { |
1807 | QMessageBox::message("Info","Gutenbrowser was developed by\n" | 1803 | QMessageBox::message("Info","Gutenbrowser was developed by\n" |
1808 | "Lorn Potter\n" | 1804 | "Lorn Potter\n" |
1809 | "ljp<ljp@llornkcor.com>\n"); | 1805 | "ljp<ljp@llornkcor.com>\n"); |
1810 | } | 1806 | } |