summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/openetext.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/noncore/apps/opie-gutenbrowser/openetext.cpp b/noncore/apps/opie-gutenbrowser/openetext.cpp
index a5d855d..75edacd 100644
--- a/noncore/apps/opie-gutenbrowser/openetext.cpp
+++ b/noncore/apps/opie-gutenbrowser/openetext.cpp
@@ -323,107 +323,105 @@ QString OpenEtext::titleFromLibrary( QString fileName)
// file opened successfully
QTextStream indexStream( &indexLib );
QString indexLine;
bool findCheck = FALSE;
while ( !indexStream.atEnd() ) { // until end of file..
indexLine = indexStream.readLine();
if( indexLine.find( target,0,FALSE) > 0 ) {
findCheck = TRUE;
title = indexLine.mid( 9, 50);
title = title.stripWhiteSpace ();
// odebug << "Finally Found the title and it is\n " << title << "" << oendl;
// QListBox_1->insertItem ( title);
}
} //end while loop
}
else
odebug << "Error opening library index "+ local_index << oendl;
return title;
}
bool OpenEtext::checkConf()
{
QString file = fileName;
Config config("Gutenbrowser");
config.setGroup( "Files" );
QString s_numofFiles = config.readEntry("NumberOfFiles", "0" );
int i_numofFiles = s_numofFiles.toInt();
for (int i = 1; i <= i_numofFiles; i++) {
QString temp;
temp.setNum(i);
config.setGroup( "Files");
QString ramble = config.readEntry(temp, "" );
if(ramble == file ) {
return true;
}
}
return false;
}
void OpenEtext::remove()
{
title_text = QListBox_1->text( QListBox_1->currentItem() );
title_text=title_text.stripWhiteSpace();
QString msg ="<p>Do you really want to REMOVE\n" + title_text +
"?\nThis will not delete the file.</P>";
- switch( QMessageBox::information( this, tr("Remove Etext"),
- tr(msg),
- tr("&Yes"), tr("&Cancel"), 0 ) )
- {
- case 0: // Yes clicked,
- removeSelection();
- QListBox_1->clear();
- getTitles();
- break;
- case 1:
- default:
+ unsigned short clickVal =
+ QMessageBox::information( this, tr("Remove Etext"),
+ tr(msg),
+ tr("&Yes"), tr("&Cancel"), 0 );
+ if ( clickVal == 0 ) {
+ // The yes button was clicked
+ removeSelection();
+ QListBox_1->clear();
+ getTitles();
}
}
/*!
* This removes selected title entry
*/
void OpenEtext::removeSelection()
{
Config config("Gutenbrowser");
config.setGroup( "Files" );
s_numofFiles = config.readEntry("NumberOfFiles", "0");
int rem=0;
int i_numofFiles = s_numofFiles.toInt();
QString fileNum2;
QString fileNum;
for (int i = 1; i <= i_numofFiles; i++) {
fileNum.setNum(i);
config.setGroup( "Files" );
QString s_filename = config.readEntry(fileNum, "" );
config.setGroup( "Titles" );
QString file_title = config.readEntry( s_filename, "");
if(title_text == file_title) {
rem=i;
//odebug << "file title to remove is "+file_title << oendl;
selFile = s_filename;
config.removeEntry( s_filename); //removes file=title
}
}
config.setGroup( "Files" );
for(int fg = rem; fg < i_numofFiles ; fg++ ) { //this rewrites Files number entry
fileNum.setNum(fg);
fileNum2.setNum( fg + 1);
QString s_filename2 = config.readEntry(fileNum2, "" );
if (!s_filename2.isEmpty()) {
config.writeEntry(fileNum, s_filename2 );
}
}
config.writeEntry("NumberOfFiles", i_numofFiles - 1 );
config.removeEntry(fileNum2);
}
/*!