-rw-r--r-- | library/lnkproperties.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/library/lnkproperties.cpp b/library/lnkproperties.cpp index 983c677..0b30a9a 100644 --- a/library/lnkproperties.cpp +++ b/library/lnkproperties.cpp | |||
@@ -1,309 +1,336 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT | 21 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT |
22 | // have this class. | 22 | // have this class. |
23 | #define QTOPIA_INTERNAL_FSLP | 23 | #define QTOPIA_INTERNAL_FSLP |
24 | #include "lnkproperties.h" | 24 | #include "lnkproperties.h" |
25 | #include "lnkproperties.h" | 25 | #include "lnkproperties.h" |
26 | #include "lnkpropertiesbase_p.h" | 26 | #include "lnkpropertiesbase_p.h" |
27 | #include "ir.h" | 27 | #include "ir.h" |
28 | 28 | ||
29 | #include <qpe/qpeapplication.h> | ||
29 | #include <qpe/applnk.h> | 30 | #include <qpe/applnk.h> |
30 | #include <qpe/global.h> | 31 | #include <qpe/global.h> |
31 | #include <qpe/categorywidget.h> | 32 | #include <qpe/categorywidget.h> |
32 | #ifdef QWS | 33 | #ifdef QWS |
33 | #include <qpe/qcopenvelope_qws.h> | 34 | #include <qpe/qcopenvelope_qws.h> |
34 | #endif | 35 | #endif |
35 | #include <qpe/filemanager.h> | 36 | #include <qpe/filemanager.h> |
36 | #include <qpe/config.h> | 37 | #include <qpe/config.h> |
37 | #include <qpe/storage.h> | 38 | #include <qpe/storage.h> |
38 | #include <qpe/qpemessagebox.h> | 39 | #include <qpe/qpemessagebox.h> |
39 | 40 | ||
40 | #include <qlineedit.h> | 41 | #include <qlineedit.h> |
41 | #include <qtoolbutton.h> | 42 | #include <qtoolbutton.h> |
42 | #include <qpushbutton.h> | 43 | #include <qpushbutton.h> |
43 | #include <qgroupbox.h> | 44 | #include <qgroupbox.h> |
44 | #include <qcheckbox.h> | 45 | #include <qcheckbox.h> |
45 | #include <qlabel.h> | 46 | #include <qlabel.h> |
46 | #include <qlayout.h> | 47 | #include <qlayout.h> |
47 | #include <qfile.h> | 48 | #include <qfile.h> |
48 | #include <qfileinfo.h> | 49 | #include <qfileinfo.h> |
49 | #include <qmessagebox.h> | 50 | #include <qmessagebox.h> |
50 | #include <qsize.h> | 51 | #include <qsize.h> |
51 | #include <qcombobox.h> | 52 | #include <qcombobox.h> |
52 | #include <qregexp.h> | 53 | #include <qregexp.h> |
54 | #include <qbuttongroup.h> | ||
53 | 55 | ||
54 | #include <stdlib.h> | 56 | #include <stdlib.h> |
55 | 57 | ||
56 | LnkProperties::LnkProperties( AppLnk* l, QWidget* parent ) | 58 | LnkProperties::LnkProperties( AppLnk* l, QWidget* parent ) |
57 | : QDialog( parent, 0, TRUE ), lnk(l), fileSize( 0 ) | 59 | : QDialog( parent, 0, TRUE ), lnk(l), fileSize( 0 ) |
58 | { | 60 | { |
59 | setCaption( tr("Properties") ); | 61 | setCaption( tr("Properties") ); |
60 | 62 | ||
61 | QVBoxLayout *vbox = new QVBoxLayout( this ); | 63 | QVBoxLayout *vbox = new QVBoxLayout( this ); |
62 | d = new LnkPropertiesBase( this ); | 64 | d = new LnkPropertiesBase( this ); |
63 | vbox->add( d ); | 65 | vbox->add( d ); |
64 | 66 | ||
65 | d->docname->setText(l->name()); | 67 | d->docname->setText(l->name()); |
66 | QString inf; | 68 | QString inf; |
67 | if ( l->type().isEmpty() ) { | 69 | if ( l->type().isEmpty() ) { |
68 | d->type->hide(); | 70 | d->type->hide(); |
69 | d->typeLabel->hide(); | 71 | d->typeLabel->hide(); |
70 | } else { | 72 | } else { |
71 | d->type->setText( l->type() ); | 73 | d->type->setText( l->type() ); |
72 | } | 74 | } |
73 | 75 | ||
74 | if ( l->comment().isEmpty() ) { | 76 | if ( l->comment().isEmpty() ) { |
75 | d->comment->hide(); | 77 | d->comment->hide(); |
76 | d->commentLabel->hide(); | 78 | d->commentLabel->hide(); |
77 | } else { | 79 | } else { |
78 | d->comment->setText( l->comment() ); | 80 | d->comment->setText( l->comment() ); |
79 | } | 81 | } |
80 | 82 | ||
81 | connect(d->beam,SIGNAL(clicked()),this,SLOT(beamLnk())); | 83 | connect(d->beam,SIGNAL(clicked()),this,SLOT(beamLnk())); |
82 | if ( lnk->type().contains('/') ) { // A document? (#### better predicate needed) | 84 | if ( lnk->type().contains('/') ) { // A document? (#### better predicate needed) |
83 | connect(d->unlink,SIGNAL(clicked()),this,SLOT(unlinkLnk())); | 85 | connect(d->unlink,SIGNAL(clicked()),this,SLOT(unlinkLnk())); |
84 | connect(d->duplicate,SIGNAL(clicked()),this,SLOT(duplicateLnk())); | 86 | connect(d->duplicate,SIGNAL(clicked()),this,SLOT(duplicateLnk())); |
85 | 87 | ||
86 | d->docname->setReadOnly( FALSE ); | 88 | d->docname->setReadOnly( FALSE ); |
87 | d->preload->hide(); | 89 | d->preload->hide(); |
88 | d->spacer->hide(); | 90 | d->rotate->hide(); |
91 | d->rotateButtons->hide(); | ||
92 | d->labelspacer->hide(); | ||
89 | 93 | ||
90 | // ### THIS MUST GO, FIX WIERD BUG in QLAYOUT | 94 | // ### THIS MUST GO, FIX WIERD BUG in QLAYOUT |
91 | d->categoryEdit->kludge(); | 95 | d->categoryEdit->kludge(); |
92 | 96 | ||
93 | d->categoryEdit->setCategories( lnk->categories(), | 97 | d->categoryEdit->setCategories( lnk->categories(), |
94 | "Document View", | 98 | "Document View", |
95 | tr("Document View") ); | 99 | tr("Document View") ); |
96 | setupLocations(); | 100 | setupLocations(); |
97 | } else { | 101 | } else { |
98 | d->unlink->hide(); | 102 | d->unlink->hide(); |
99 | d->duplicate->hide(); | 103 | d->duplicate->hide(); |
100 | d->beam->hide(); | 104 | d->beam->hide(); |
101 | d->hline->hide(); | 105 | d->hline->hide(); |
102 | d->locationLabel->hide(); | 106 | d->locationLabel->hide(); |
103 | d->locationCombo->hide(); | 107 | d->locationCombo->hide(); |
104 | 108 | ||
105 | // Can't edit categories, since the app .desktop files are global, | 109 | // Can't edit categories, since the app .desktop files are global, |
106 | // possibly read-only. | 110 | // possibly read-only. |
107 | d->categoryEdit->hide(); | 111 | d->categoryEdit->hide(); |
108 | 112 | ||
109 | d->docname->setReadOnly( TRUE ); | 113 | d->docname->setReadOnly( TRUE ); |
110 | 114 | ||
111 | if ( l->property("CanFastload") == "0" ) | 115 | if ( l->property("CanFastload") == "0" ) |
112 | d->preload->hide(); | 116 | d->preload->hide(); |
117 | if ( !l->property("Rotation"). isEmpty ()) { | ||
118 | d->rotate->setChecked ( true ); | ||
119 | d->rotateButtons->setButton(((QPEApplication::defaultRotation()+l->rotation().toInt())%360)/90); | ||
120 | } | ||
121 | else { | ||
122 | d->rotateButtons->setEnabled(false); | ||
123 | } | ||
113 | 124 | ||
114 | Config cfg("Launcher"); | 125 | Config cfg("Launcher"); |
115 | cfg.setGroup("Preload"); | 126 | cfg.setGroup("Preload"); |
116 | QStringList apps = cfg.readListEntry("Apps",','); | 127 | QStringList apps = cfg.readListEntry("Apps",','); |
117 | d->preload->setChecked( apps.contains(l->exec()) ); | 128 | d->preload->setChecked( apps.contains(l->exec()) ); |
118 | if ( Global::isBuiltinCommand(lnk->exec()) ) | 129 | if ( Global::isBuiltinCommand(lnk->exec()) ) |
119 | d->preload->hide(); // builtins are always fast | 130 | d->preload->hide(); // builtins are always fast |
120 | 131 | ||
121 | currentLocation = 0; // apps not movable (yet) | 132 | currentLocation = 0; // apps not movable (yet) |
122 | } | 133 | } |
123 | } | 134 | } |
124 | 135 | ||
125 | LnkProperties::~LnkProperties() | 136 | LnkProperties::~LnkProperties() |
126 | { | 137 | { |
127 | } | 138 | } |
128 | 139 | ||
129 | void LnkProperties::unlinkLnk() | 140 | void LnkProperties::unlinkLnk() |
130 | { | 141 | { |
131 | if ( QPEMessageBox::confirmDelete( this, tr("Delete"), lnk->name() ) ) { | 142 | if ( QPEMessageBox::confirmDelete( this, tr("Delete"), lnk->name() ) ) { |
132 | lnk->removeFiles(); | 143 | lnk->removeFiles(); |
133 | if ( QFile::exists(lnk->file()) ) { | 144 | if ( QFile::exists(lnk->file()) ) { |
134 | QMessageBox::warning( this, tr("Delete"), tr("File deletion failed.") ); | 145 | QMessageBox::warning( this, tr("Delete"), tr("File deletion failed.") ); |
135 | } else { | 146 | } else { |
136 | reject(); | 147 | reject(); |
137 | } | 148 | } |
138 | } | 149 | } |
139 | } | 150 | } |
140 | 151 | ||
141 | void LnkProperties::setupLocations() | 152 | void LnkProperties::setupLocations() |
142 | { | 153 | { |
143 | QFileInfo fi( lnk->file() ); | 154 | QFileInfo fi( lnk->file() ); |
144 | fileSize = fi.size(); | 155 | fileSize = fi.size(); |
145 | StorageInfo storage; | 156 | StorageInfo storage; |
146 | const QList<FileSystem> &fs = storage.fileSystems(); | 157 | const QList<FileSystem> &fs = storage.fileSystems(); |
147 | QListIterator<FileSystem> it ( fs ); | 158 | QListIterator<FileSystem> it ( fs ); |
148 | QString s; | 159 | QString s; |
149 | QString homeDir = getenv("HOME"); | 160 | QString homeDir = getenv("HOME"); |
150 | QString hardDiskHome; | 161 | QString hardDiskHome; |
151 | QString hardDiskPath; | 162 | QString hardDiskPath; |
152 | int index = 0; | 163 | int index = 0; |
153 | currentLocation = -1; | 164 | currentLocation = -1; |
154 | for ( ; it.current(); ++it ) { | 165 | for ( ; it.current(); ++it ) { |
155 | // we add 10k to the file size so we are sure we can also save the desktop file | 166 | // we add 10k to the file size so we are sure we can also save the desktop file |
156 | if ( (ulong)(*it)->availBlocks() * (ulong)(*it)->blockSize() > (ulong)fileSize + 10000 ) { | 167 | if ( (ulong)(*it)->availBlocks() * (ulong)(*it)->blockSize() > (ulong)fileSize + 10000 ) { |
157 | if ( (*it)->isRemovable() || | 168 | if ( (*it)->isRemovable() || |
158 | (*it)->disk() == "/dev/mtdblock1" || | 169 | (*it)->disk() == "/dev/mtdblock1" || |
159 | (*it)->disk() == "/dev/mtdblock/1" || | 170 | (*it)->disk() == "/dev/mtdblock/1" || |
160 | (*it)->disk().left(13) == "/dev/mtdblock" || | 171 | (*it)->disk().left(13) == "/dev/mtdblock" || |
161 | (*it)->disk() == "/dev/mtdblock6" || | 172 | (*it)->disk() == "/dev/mtdblock6" || |
162 | (*it)->disk() == "tmpfs" ) { | 173 | (*it)->disk() == "tmpfs" ) { |
163 | d->locationCombo->insertItem( (*it)->name(), index ); | 174 | d->locationCombo->insertItem( (*it)->name(), index ); |
164 | locations.append( ( ((*it)->isRemovable() || | 175 | locations.append( ( ((*it)->isRemovable() || |
165 | (*it)->disk() == "/dev/mtdblock6" || | 176 | (*it)->disk() == "/dev/mtdblock6" || |
166 | (*it)->disk() == "tmpfs" ) | 177 | (*it)->disk() == "tmpfs" ) |
167 | ? (*it)->path() : homeDir) ); | 178 | ? (*it)->path() : homeDir) ); |
168 | if ( lnk->file().contains( (*it)->path() ) ) { | 179 | if ( lnk->file().contains( (*it)->path() ) ) { |
169 | d->locationCombo->setCurrentItem( index ); | 180 | d->locationCombo->setCurrentItem( index ); |
170 | currentLocation = index; | 181 | currentLocation = index; |
171 | } | 182 | } |
172 | index++; | 183 | index++; |
173 | } else if ( (*it)->name().contains( tr("Hard Disk") ) && | 184 | } else if ( (*it)->name().contains( tr("Hard Disk") ) && |
174 | homeDir.contains( (*it)->path() ) && | 185 | homeDir.contains( (*it)->path() ) && |
175 | (*it)->path().length() > hardDiskHome.length() ) { | 186 | (*it)->path().length() > hardDiskHome.length() ) { |
176 | hardDiskHome = (*it)->name(); | 187 | hardDiskHome = (*it)->name(); |
177 | hardDiskPath = (*it)->path(); | 188 | hardDiskPath = (*it)->path(); |
178 | } | 189 | } |
179 | } | 190 | } |
180 | } | 191 | } |
181 | if ( !hardDiskHome.isEmpty() ) { | 192 | if ( !hardDiskHome.isEmpty() ) { |
182 | d->locationCombo->insertItem( hardDiskHome ); | 193 | d->locationCombo->insertItem( hardDiskHome ); |
183 | locations.append( hardDiskPath ); | 194 | locations.append( hardDiskPath ); |
184 | if ( currentLocation == -1 ) { // assume it's the hard disk | 195 | if ( currentLocation == -1 ) { // assume it's the hard disk |
185 | d->locationCombo->setCurrentItem( index ); | 196 | d->locationCombo->setCurrentItem( index ); |
186 | currentLocation = index; | 197 | currentLocation = index; |
187 | } | 198 | } |
188 | } | 199 | } |
189 | } | 200 | } |
190 | 201 | ||
191 | void LnkProperties::duplicateLnk() | 202 | void LnkProperties::duplicateLnk() |
192 | { | 203 | { |
193 | // The duplicate takes the new properties. | 204 | // The duplicate takes the new properties. |
194 | DocLnk newdoc( *((DocLnk *)lnk) ); | 205 | DocLnk newdoc( *((DocLnk *)lnk) ); |
195 | if ( d->docname->text() == lnk->name() ) | 206 | if ( d->docname->text() == lnk->name() ) |
196 | newdoc.setName(tr("Copy of ")+d->docname->text()); | 207 | newdoc.setName(tr("Copy of ")+d->docname->text()); |
197 | else | 208 | else |
198 | newdoc.setName(d->docname->text()); | 209 | newdoc.setName(d->docname->text()); |
199 | 210 | ||
200 | if ( !copyFile( newdoc ) ) { | 211 | if ( !copyFile( newdoc ) ) { |
201 | QMessageBox::warning( this, tr("Duplicate"), tr("File copy failed.") ); | 212 | QMessageBox::warning( this, tr("Duplicate"), tr("File copy failed.") ); |
202 | return; | 213 | return; |
203 | } | 214 | } |
204 | reject(); | 215 | reject(); |
205 | } | 216 | } |
206 | 217 | ||
207 | bool LnkProperties::moveLnk() | 218 | bool LnkProperties::moveLnk() |
208 | { | 219 | { |
209 | DocLnk newdoc( *((DocLnk *)lnk) ); | 220 | DocLnk newdoc( *((DocLnk *)lnk) ); |
210 | newdoc.setName(d->docname->text()); | 221 | newdoc.setName(d->docname->text()); |
211 | 222 | ||
212 | if ( !copyFile( newdoc ) ) { | 223 | if ( !copyFile( newdoc ) ) { |
213 | QMessageBox::warning( this, tr("Details"), tr("Moving Document failed.") ); | 224 | QMessageBox::warning( this, tr("Details"), tr("Moving Document failed.") ); |
214 | return FALSE; | 225 | return FALSE; |
215 | } | 226 | } |
216 | // remove old lnk | 227 | // remove old lnk |
217 | lnk->removeFiles(); | 228 | lnk->removeFiles(); |
218 | 229 | ||
219 | return TRUE; | 230 | return TRUE; |
220 | } | 231 | } |
221 | 232 | ||
222 | void LnkProperties::beamLnk() | 233 | void LnkProperties::beamLnk() |
223 | { | 234 | { |
224 | Ir ir; | 235 | Ir ir; |
225 | DocLnk doc( *((DocLnk *)lnk) ); | 236 | DocLnk doc( *((DocLnk *)lnk) ); |
226 | doc.setName(d->docname->text()); | 237 | doc.setName(d->docname->text()); |
227 | reject(); | 238 | reject(); |
228 | ir.send( doc, doc.comment() ); | 239 | ir.send( doc, doc.comment() ); |
229 | } | 240 | } |
230 | 241 | ||
231 | bool LnkProperties::copyFile( DocLnk &newdoc ) | 242 | bool LnkProperties::copyFile( DocLnk &newdoc ) |
232 | { | 243 | { |
233 | const char *linkExtn = ".desktop"; | 244 | const char *linkExtn = ".desktop"; |
234 | QString fileExtn; | 245 | QString fileExtn; |
235 | int extnPos = lnk->file().findRev( '.' ); | 246 | int extnPos = lnk->file().findRev( '.' ); |
236 | if ( extnPos > 0 ) | 247 | if ( extnPos > 0 ) |
237 | fileExtn = lnk->file().mid( extnPos ); | 248 | fileExtn = lnk->file().mid( extnPos ); |
238 | 249 | ||
239 | QString safename = newdoc.name(); | 250 | QString safename = newdoc.name(); |
240 | safename.replace(QRegExp("/"),"_"); | 251 | safename.replace(QRegExp("/"),"_"); |
241 | 252 | ||
242 | QString fn = locations[ d->locationCombo->currentItem() ] | 253 | QString fn = locations[ d->locationCombo->currentItem() ] |
243 | + "/Documents/" + newdoc.type() + "/" + safename; | 254 | + "/Documents/" + newdoc.type() + "/" + safename; |
244 | if ( QFile::exists(fn + fileExtn) || QFile::exists(fn + linkExtn) ) { | 255 | if ( QFile::exists(fn + fileExtn) || QFile::exists(fn + linkExtn) ) { |
245 | int n=1; | 256 | int n=1; |
246 | QString nn = fn + "_" + QString::number(n); | 257 | QString nn = fn + "_" + QString::number(n); |
247 | while ( QFile::exists(nn+fileExtn) || QFile::exists(nn+linkExtn) ) { | 258 | while ( QFile::exists(nn+fileExtn) || QFile::exists(nn+linkExtn) ) { |
248 | n++; | 259 | n++; |
249 | nn = fn + "_" + QString::number(n); | 260 | nn = fn + "_" + QString::number(n); |
250 | } | 261 | } |
251 | fn = nn; | 262 | fn = nn; |
252 | } | 263 | } |
253 | newdoc.setFile( fn + fileExtn ); | 264 | newdoc.setFile( fn + fileExtn ); |
254 | newdoc.setLinkFile( fn + linkExtn ); | 265 | newdoc.setLinkFile( fn + linkExtn ); |
255 | 266 | ||
256 | // Copy file | 267 | // Copy file |
257 | FileManager fm; | 268 | FileManager fm; |
258 | if ( !fm.copyFile( *lnk, newdoc ) ) | 269 | if ( !fm.copyFile( *lnk, newdoc ) ) |
259 | return FALSE; | 270 | return FALSE; |
260 | return TRUE; | 271 | return TRUE; |
261 | } | 272 | } |
262 | 273 | ||
263 | void LnkProperties::done(int ok) | 274 | void LnkProperties::done(int ok) |
264 | { | 275 | { |
265 | if ( ok ) { | 276 | if ( ok ) { |
266 | bool changed=FALSE; | 277 | bool changed=FALSE; |
267 | if ( lnk->name() != d->docname->text() ) { | 278 | if ( lnk->name() != d->docname->text() ) { |
268 | lnk->setName(d->docname->text()); | 279 | lnk->setName(d->docname->text()); |
269 | changed=TRUE; | 280 | changed=TRUE; |
270 | } | 281 | } |
271 | if ( d->categoryEdit->isVisible() ) { | 282 | if ( d->categoryEdit->isVisible() ) { |
272 | QArray<int> tmp = d->categoryEdit->newCategories(); | 283 | QArray<int> tmp = d->categoryEdit->newCategories(); |
273 | if ( lnk->categories() != tmp ) { | 284 | if ( lnk->categories() != tmp ) { |
274 | lnk->setCategories( tmp ); | 285 | lnk->setCategories( tmp ); |
275 | changed = TRUE; | 286 | changed = TRUE; |
276 | } | 287 | } |
277 | } | 288 | } |
289 | if ( !d->rotate->isHidden()) { | ||
290 | QString newrot; | ||
291 | |||
292 | if (d->rotate->isChecked()) { | ||
293 | int rot=0; | ||
294 | for(; rot<4; rot++) { | ||
295 | if (d->rotateButtons->find(rot)->isOn()) | ||
296 | break; | ||
297 | } | ||
298 | newrot = QString::number((QPEApplication::defaultRotation()+rot*90)%360); | ||
299 | } | ||
300 | if (newrot !=lnk->rotation()) { | ||
301 | lnk->setRotation(newrot); | ||
302 | changed = TRUE; | ||
303 | } | ||
304 | } | ||
278 | if ( d->preload->isHidden() && d->locationCombo->currentItem() != currentLocation ) { | 305 | if ( d->preload->isHidden() && d->locationCombo->currentItem() != currentLocation ) { |
279 | moveLnk(); | 306 | moveLnk(); |
280 | } else if ( changed ) { | 307 | } else if ( changed ) { |
281 | lnk->writeLink(); | 308 | lnk->writeLink(); |
282 | } | 309 | } |
283 | 310 | ||
284 | if ( !d->preload->isHidden() ) { | 311 | if ( !d->preload->isHidden() ) { |
285 | Config cfg("Launcher"); | 312 | Config cfg("Launcher"); |
286 | cfg.setGroup("Preload"); | 313 | cfg.setGroup("Preload"); |
287 | QStringList apps = cfg.readListEntry("Apps",','); | 314 | QStringList apps = cfg.readListEntry("Apps",','); |
288 | QString exe = lnk->exec(); | 315 | QString exe = lnk->exec(); |
289 | if ( apps.contains(exe) != d->preload->isChecked() ) { | 316 | if ( apps.contains(exe) != d->preload->isChecked() ) { |
290 | if ( d->preload->isChecked() ) { | 317 | if ( d->preload->isChecked() ) { |
291 | apps.append(exe); | 318 | apps.append(exe); |
292 | #ifndef QT_NO_COP | 319 | #ifndef QT_NO_COP |
293 | QCopEnvelope e("QPE/Application/"+exe.local8Bit(), | 320 | QCopEnvelope e("QPE/Application/"+exe.local8Bit(), |
294 | "enablePreload()"); | 321 | "enablePreload()"); |
295 | #endif | 322 | #endif |
296 | } else { | 323 | } else { |
297 | apps.remove(exe); | 324 | apps.remove(exe); |
298 | #ifndef QT_NO_COP | 325 | #ifndef QT_NO_COP |
299 | QCopEnvelope e("QPE/Application/"+exe.local8Bit(), | 326 | QCopEnvelope e("QPE/Application/"+exe.local8Bit(), |
300 | "quitIfInvisible()"); | 327 | "quitIfInvisible()"); |
301 | #endif | 328 | #endif |
302 | } | 329 | } |
303 | cfg.writeEntry("Apps",apps,','); | 330 | cfg.writeEntry("Apps",apps,','); |
304 | } | 331 | } |
305 | } | 332 | } |
306 | } | 333 | } |
307 | QDialog::done( ok ); | 334 | QDialog::done( ok ); |
308 | } | 335 | } |
309 | 336 | ||