author | llornkcor <llornkcor> | 2004-04-08 23:13:24 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-04-08 23:13:24 (UTC) |
commit | 8ea8d193ff14250d4dbc0fc3d4699e5888ba35fe (patch) (unidiff) | |
tree | fced2b714b39a5f2747e36a9784f6fc131e77c55 | |
parent | 502281033b395bb5f089a2bbaa86f9ba423dec84 (diff) | |
download | opie-8ea8d193ff14250d4dbc0fc3d4699e5888ba35fe.zip opie-8ea8d193ff14250d4dbc0fc3d4699e5888ba35fe.tar.gz opie-8ea8d193ff14250d4dbc0fc3d4699e5888ba35fe.tar.bz2 |
fix segfault in d'tor
-rw-r--r-- | noncore/apps/opie-gutenbrowser/LibraryDialog.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp index 157a3da..5b22b00 100644 --- a/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp +++ b/noncore/apps/opie-gutenbrowser/LibraryDialog.cpp | |||
@@ -41,103 +41,103 @@ LibraryDialog::LibraryDialog( QWidget* parent, const char* name , bool modal, W | |||
41 | 41 | ||
42 | // this->setMaximumWidth(240); | 42 | // this->setMaximumWidth(240); |
43 | 43 | ||
44 | index = "GUTINDEX.ALL"; | 44 | index = "GUTINDEX.ALL"; |
45 | local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; | 45 | local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; |
46 | local_index = local_library + index; | 46 | local_index = local_library + index; |
47 | 47 | ||
48 | QString iniFile ; | 48 | QString iniFile ; |
49 | iniFile = QPEApplication::qpeDir()+"/etc/gutenbrowser/gutenbrowserrc"; | 49 | iniFile = QPEApplication::qpeDir()+"/etc/gutenbrowser/gutenbrowserrc"; |
50 | 50 | ||
51 | new_index =QPEApplication::qpeDir()+"/etc/gutenbrowser/PGWHOLE.TXT"; | 51 | new_index =QPEApplication::qpeDir()+"/etc/gutenbrowser/PGWHOLE.TXT"; |
52 | 52 | ||
53 | old_index = QPEApplication::qpeDir()+"/etc/gutenbrowser/GUTINDEX.ALL"; | 53 | old_index = QPEApplication::qpeDir()+"/etc/gutenbrowser/GUTINDEX.ALL"; |
54 | // old_index = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; | 54 | // old_index = QPEApplication::qpeDir()+"etc/gutenbrowser/GUTINDEX.ALL"; |
55 | 55 | ||
56 | // iniFile = local_library+"gutenbrowserrc"; | 56 | // iniFile = local_library+"gutenbrowserrc"; |
57 | // new_index = local_library + "PGWHOLE.TXT"; | 57 | // new_index = local_library + "PGWHOLE.TXT"; |
58 | // old_index = local_library + "GUTINDEX.ALL"; | 58 | // old_index = local_library + "GUTINDEX.ALL"; |
59 | 59 | ||
60 | Config config("Gutenbrowser"); | 60 | Config config("Gutenbrowser"); |
61 | 61 | ||
62 | config.setGroup( "HttpServer" ); | 62 | config.setGroup( "HttpServer" ); |
63 | proxy_http = config.readEntry("Preferred", "http://sailor.gutenbook.org"); | 63 | proxy_http = config.readEntry("Preferred", "http://sailor.gutenbook.org"); |
64 | 64 | ||
65 | config.setGroup( "FTPsite" ); | 65 | config.setGroup( "FTPsite" ); |
66 | ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org"); | 66 | ftp_host=config.readEntry("SiteName", "sailor.gutenberg.org"); |
67 | qDebug("Library Dialog: ftp_host is "+ftp_host); | 67 | qDebug("Library Dialog: ftp_host is "+ftp_host); |
68 | // ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); | 68 | // ftp_host=ftp_host.right(ftp_host.length()-(ftp_host.find(") ",0,TRUE)+1) ); |
69 | // ftp_host=ftp_host.stripWhiteSpace(); | 69 | // ftp_host=ftp_host.stripWhiteSpace(); |
70 | ftp_base_dir= config.readEntry("base", "/pub/gutenberg"); | 70 | ftp_base_dir= config.readEntry("base", "/pub/gutenberg"); |
71 | 71 | ||
72 | i_binary = 0; | 72 | i_binary = 0; |
73 | 73 | ||
74 | config.setGroup("SortAuth"); | 74 | config.setGroup("SortAuth"); |
75 | if( config.readEntry("authSort", "FALSE") == "TRUE") | 75 | if( config.readEntry("authSort", "FALSE") == "TRUE") |
76 | authBox->setChecked(TRUE); | 76 | authBox->setChecked(TRUE); |
77 | 77 | ||
78 | config.setGroup("General"); | 78 | config.setGroup("General"); |
79 | downDir =config.readEntry( "DownloadDirectory",local_library); | 79 | downDir =config.readEntry( "DownloadDirectory",local_library); |
80 | qDebug("downDir is "+downDir); | 80 | qDebug("downDir is "+downDir); |
81 | newindexLib.setName( old_index); | 81 | newindexLib.setName( old_index); |
82 | indexLib.setName( old_index); | 82 | indexLib.setName( old_index); |
83 | 83 | ||
84 | new QPEDialogListener(this); | 84 | new QPEDialogListener(this); |
85 | } | 85 | } |
86 | 86 | ||
87 | LibraryDialog::~LibraryDialog() | 87 | LibraryDialog::~LibraryDialog() |
88 | { | 88 | { |
89 | delete QList_Item2; | 89 | // delete QList_Item2; |
90 | delete QList_Item1; | 90 | // delete QList_Item1; |
91 | delete QList_Item3; | 91 | // delete QList_Item3; |
92 | delete QList_Item4; | 92 | // delete QList_Item4; |
93 | delete QList_Item5; | 93 | // delete QList_Item5; |
94 | 94 | ||
95 | saveConfig(); | 95 | //saveConfig(); |
96 | } | 96 | } |
97 | 97 | ||
98 | /*This groks using PGWHOLE.TXT */ | 98 | /*This groks using PGWHOLE.TXT */ |
99 | void LibraryDialog::Newlibrary() | 99 | void LibraryDialog::Newlibrary() |
100 | { | 100 | { |
101 | #ifndef Q_WS_QWS //sorry embedded gutenbrowser cant use zip files | 101 | #ifndef Q_WS_QWS //sorry embedded gutenbrowser cant use zip files |
102 | //qDebug("Opening new library index %s",newindexLib); | 102 | //qDebug("Opening new library index %s",newindexLib); |
103 | if ( newindexLib.open( IO_ReadOnly) ) { | 103 | if ( newindexLib.open( IO_ReadOnly) ) { |
104 | setCaption( tr( "Library Index - using master pg index." ) );// file opened successfully | 104 | setCaption( tr( "Library Index - using master pg index." ) );// file opened successfully |
105 | QTextStream indexStream( &newindexLib ); | 105 | QTextStream indexStream( &newindexLib ); |
106 | QString indexLine; | 106 | QString indexLine; |
107 | while ( !indexStream.atEnd() ) { // until end of file.. | 107 | while ( !indexStream.atEnd() ) { // until end of file.. |
108 | indexLine = indexStream.readLine(); | 108 | indexLine = indexStream.readLine(); |
109 | if ( ( indexLine.mid(4,4)).toInt() && !( indexLine.left(3)).toInt()) { | 109 | if ( ( indexLine.mid(4,4)).toInt() && !( indexLine.left(3)).toInt()) { |
110 | year = indexLine.mid(4,4); | 110 | year = indexLine.mid(4,4); |
111 | year = year.stripWhiteSpace(); | 111 | year = year.stripWhiteSpace(); |
112 | file = indexLine.mid( indexLine.find( "[", 0, TRUE )+1, 12 ); | 112 | file = indexLine.mid( indexLine.find( "[", 0, TRUE )+1, 12 ); |
113 | file = file.stripWhiteSpace(); | 113 | file = file.stripWhiteSpace(); |
114 | number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); | 114 | number = indexLine.mid( indexLine.find( "]", 0, TRUE ) +1, indexLine.find( " ", 0, TRUE )+1 ); |
115 | if( year.toInt() < 1984) | 115 | if( year.toInt() < 1984) |
116 | number = number.left( number.length() -1 ); | 116 | number = number.left( number.length() -1 ); |
117 | number = number.stripWhiteSpace(); | 117 | number = number.stripWhiteSpace(); |
118 | title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); | 118 | title = indexLine.mid( indexLine.find(" ", 26, TRUE), indexLine.length() ); |
119 | title = title.stripWhiteSpace(); | 119 | title = title.stripWhiteSpace(); |
120 | 120 | ||
121 | getAuthor(); // groks author | 121 | getAuthor(); // groks author |
122 | author = author.stripWhiteSpace(); | 122 | author = author.stripWhiteSpace(); |
123 | if (authBox->isChecked()) { // this reverses the first name and last name of the author | 123 | if (authBox->isChecked()) { // this reverses the first name and last name of the author |
124 | // qDebug("Sorting last name first"); | 124 | // qDebug("Sorting last name first"); |
125 | QString lastName, firstName=""; | 125 | QString lastName, firstName=""; |
126 | int finder=author.findRev( ' ', -1, TRUE); | 126 | int finder=author.findRev( ' ', -1, TRUE); |
127 | lastName=author.right( author.length()-finder); | 127 | lastName=author.right( author.length()-finder); |
128 | firstName=author.left(finder); | 128 | firstName=author.left(finder); |
129 | lastName=lastName.stripWhiteSpace(); | 129 | lastName=lastName.stripWhiteSpace(); |
130 | firstName=firstName.stripWhiteSpace(); | 130 | firstName=firstName.stripWhiteSpace(); |
131 | 131 | ||
132 | if( lastName.find( firstName, 0, true) == -1) // this avoids dup names | 132 | if( lastName.find( firstName, 0, true) == -1) // this avoids dup names |
133 | author=lastName+", "+firstName; | 133 | author=lastName+", "+firstName; |
134 | } | 134 | } |
135 | 135 | ||
136 | if( !number.isEmpty() && (title.find( "reserved",0, FALSE) == -1) && (file.find( "]",0, TRUE) == -1) ) { | 136 | if( !number.isEmpty() && (title.find( "reserved",0, FALSE) == -1) && (file.find( "]",0, TRUE) == -1) ) { |
137 | 137 | ||
138 | // fill string list or something to be able to resort the whole library | 138 | // fill string list or something to be able to resort the whole library |
139 | if( author.isEmpty() ) | 139 | if( author.isEmpty() ) |
140 | QList_Item5 = new QListViewItem( ListView5, /* number,*/ title, author, year, file ); | 140 | QList_Item5 = new QListViewItem( ListView5, /* number,*/ title, author, year, file ); |
141 | else { | 141 | else { |
142 | 142 | ||
143 | if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) || | 143 | if( (author.left(1) >= QString("A") && author.left(1) <= QString("F")) || |