summaryrefslogtreecommitdiff
authoralwin <alwin>2005-03-07 14:37:57 (UTC)
committer alwin <alwin>2005-03-07 14:37:57 (UTC)
commit61b9d5f646faa5bd84391318f6440bee6cbefcd8 (patch) (unidiff)
treeb05eba6d4f33dd501c8fe6af0579567de7f659ec
parent9ac0dc3c7b4e56f38c3cefce2e5699078aa3a357 (diff)
downloadopie-61b9d5f646faa5bd84391318f6440bee6cbefcd8.zip
opie-61b9d5f646faa5bd84391318f6440bee6cbefcd8.tar.gz
opie-61b9d5f646faa5bd84391318f6440bee6cbefcd8.tar.bz2
when copying a file to another storage it checks if the target-dir
(eg <storage>/Documents/<mime>/<mimesub>) exists and create it otherwise.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/lnkproperties.cpp42
1 files changed, 40 insertions, 2 deletions
diff --git a/library/lnkproperties.cpp b/library/lnkproperties.cpp
index f0f0bba..f05f398 100644
--- a/library/lnkproperties.cpp
+++ b/library/lnkproperties.cpp
@@ -1,353 +1,391 @@
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 "lnkpropertiesbase_p.h" 24#include "lnkpropertiesbase_p.h"
25#include "lnkproperties.h" 25#include "lnkproperties.h"
26#include "ir.h" 26#include "ir.h"
27 27
28#include <qpe/qpeapplication.h> 28#include <qpe/qpeapplication.h>
29#include <qpe/applnk.h> 29#include <qpe/applnk.h>
30#include <qpe/global.h> 30#include <qpe/global.h>
31#include <qpe/categorywidget.h> 31#include <qpe/categorywidget.h>
32#include <qpe/qcopenvelope_qws.h> 32#include <qpe/qcopenvelope_qws.h>
33#include <qpe/filemanager.h> 33#include <qpe/filemanager.h>
34#include <qpe/config.h> 34#include <qpe/config.h>
35#include <qpe/storage.h> 35#include <qpe/storage.h>
36#include <qpe/qpemessagebox.h> 36#include <qpe/qpemessagebox.h>
37#include <qpe/mimetype.h> 37#include <qpe/mimetype.h>
38 38
39#include <qlineedit.h> 39#include <qlineedit.h>
40#include <qtoolbutton.h> 40#include <qtoolbutton.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qgroupbox.h> 42#include <qgroupbox.h>
43#include <qcheckbox.h> 43#include <qcheckbox.h>
44#include <qlabel.h> 44#include <qlabel.h>
45#include <qlayout.h> 45#include <qlayout.h>
46#include <qfile.h> 46#include <qfile.h>
47#include <qdir.h>
47#include <qfileinfo.h> 48#include <qfileinfo.h>
48#include <qmessagebox.h> 49#include <qmessagebox.h>
49#include <qsize.h> 50#include <qsize.h>
50#include <qcombobox.h> 51#include <qcombobox.h>
51#include <qregexp.h> 52#include <qregexp.h>
52#include <qbuttongroup.h> 53#include <qbuttongroup.h>
53 54
54#include <stdlib.h> 55#include <stdlib.h>
55 56
56LnkProperties::LnkProperties( AppLnk* l, QWidget* parent ) 57LnkProperties::LnkProperties( AppLnk* l, QWidget* parent )
57 : QDialog( parent, 0, TRUE ), lnk(l), fileSize( 0 ) 58 : QDialog( parent, 0, TRUE ), lnk(l), fileSize( 0 )
58{ 59{
59 setCaption( tr("Properties") ); 60 setCaption( tr("Properties") );
60 61
61 QVBoxLayout *vbox = new QVBoxLayout( this ); 62 QVBoxLayout *vbox = new QVBoxLayout( this );
62 d = new LnkPropertiesBase( this ); 63 d = new LnkPropertiesBase( this );
63 vbox->add( d ); 64 vbox->add( d );
64 65
65 // hide custom rotation feature for now, need a new implementation to fit quicklauch, 66 // hide custom rotation feature for now, need a new implementation to fit quicklauch,
66 // is confusing for the user and doubtable useful since life rotation 67 // is confusing for the user and doubtable useful since life rotation
67 d->rotate->hide(); 68 d->rotate->hide();
68 d->rotateButtons->hide(); 69 d->rotateButtons->hide();
69 70
70 d->docname->setText(l->name()); 71 d->docname->setText(l->name());
71 QString inf; 72 QString inf;
72 if ( l->type().isEmpty() ) { 73 if ( l->type().isEmpty() ) {
73 d->type->hide(); 74 d->type->hide();
74 d->typeLabel->hide(); 75 d->typeLabel->hide();
75 } else { 76 } else {
76 d->type->setText( l->type() ); 77 d->type->setText( l->type() );
77 } 78 }
78 79
79 if ( l->comment().isEmpty() ) { 80 if ( l->comment().isEmpty() ) {
80 d->comment->hide(); 81 d->comment->hide();
81 d->commentLabel->hide(); 82 d->commentLabel->hide();
82 } else { 83 } else {
83 d->comment->setText( l->comment() ); 84 d->comment->setText( l->comment() );
84 } 85 }
85 86
86 connect(d->beam,SIGNAL(clicked()),this,SLOT(beamLnk())); 87 connect(d->beam,SIGNAL(clicked()),this,SLOT(beamLnk()));
87 if ( lnk->type().contains('/') ) { // A document? (#### better predicate needed) 88 if ( lnk->type().contains('/') ) { // A document? (#### better predicate needed)
88 connect(d->unlink,SIGNAL(clicked()),this,SLOT(unlinkLnk())); 89 connect(d->unlink,SIGNAL(clicked()),this,SLOT(unlinkLnk()));
89 connect(d->duplicate,SIGNAL(clicked()),this,SLOT(duplicateLnk())); 90 connect(d->duplicate,SIGNAL(clicked()),this,SLOT(duplicateLnk()));
90 91
91 d->docname->setReadOnly( FALSE ); 92 d->docname->setReadOnly( FALSE );
92 d->preload->hide(); 93 d->preload->hide();
93 d->rotate->hide(); 94 d->rotate->hide();
94 d->rotateButtons->hide(); 95 d->rotateButtons->hide();
95 d->labelspacer->hide(); 96 d->labelspacer->hide();
96 97
97 // ### THIS MUST GO, FIX WIERD BUG in QLAYOUT 98 // ### THIS MUST GO, FIX WIERD BUG in QLAYOUT
98 d->categoryEdit->kludge(); 99 d->categoryEdit->kludge();
99 100
100 d->categoryEdit->setCategories( lnk->categories(), 101 d->categoryEdit->setCategories( lnk->categories(),
101 "Document View", 102 "Document View",
102 tr("Document View") ); 103 tr("Document View") );
103 setupLocations(); 104 setupLocations();
104 } else { 105 } else {
105 d->unlink->hide(); 106 d->unlink->hide();
106 d->duplicate->hide(); 107 d->duplicate->hide();
107 d->beam->hide(); 108 d->beam->hide();
108 d->hline->hide(); 109 d->hline->hide();
109 d->locationLabel->hide(); 110 d->locationLabel->hide();
110 d->locationCombo->hide(); 111 d->locationCombo->hide();
111 112
112 // Can't edit categories, since the app .desktop files are global, 113 // Can't edit categories, since the app .desktop files are global,
113 // possibly read-only. 114 // possibly read-only.
114 d->categoryEdit->hide(); 115 d->categoryEdit->hide();
115 116
116 d->docname->setReadOnly( TRUE ); 117 d->docname->setReadOnly( TRUE );
117 118
118 if ( l->property("CanFastload") == "0" ) 119 if ( l->property("CanFastload") == "0" )
119 d->preload->hide(); 120 d->preload->hide();
120 if ( !l->property("Rotation"). isEmpty ()) { 121 if ( !l->property("Rotation"). isEmpty ()) {
121 d->rotate->setChecked ( true ); 122 d->rotate->setChecked ( true );
122 //don't use rotate buttons for now (see comment above) 123 //don't use rotate buttons for now (see comment above)
123 //d->rotateButtons->setButton((l->rotation().toInt()%360)/90); 124 //d->rotateButtons->setButton((l->rotation().toInt()%360)/90);
124 } 125 }
125 else { 126 else {
126 d->rotateButtons->setEnabled(false); 127 d->rotateButtons->setEnabled(false);
127 } 128 }
128 129
129 if ( !l->property( "Arguments" ).isEmpty() ) 130 if ( !l->property( "Arguments" ).isEmpty() )
130 d->arguments->setText( l->property( "Arguments" ) ); 131 d->arguments->setText( l->property( "Arguments" ) );
131 132
132 Config cfg("Launcher"); 133 Config cfg("Launcher");
133 cfg.setGroup("Preload"); 134 cfg.setGroup("Preload");
134 QStringList apps = cfg.readListEntry("Apps",','); 135 QStringList apps = cfg.readListEntry("Apps",',');
135 d->preload->setChecked( apps.contains(l->exec()) ); 136 d->preload->setChecked( apps.contains(l->exec()) );
136 if ( Global::isBuiltinCommand(lnk->exec()) ) 137 if ( Global::isBuiltinCommand(lnk->exec()) )
137 d->preload->hide(); // builtins are always fast 138 d->preload->hide(); // builtins are always fast
138 139
139 currentLocation = 0; // apps not movable (yet) 140 currentLocation = 0; // apps not movable (yet)
140 } 141 }
141} 142}
142 143
143LnkProperties::~LnkProperties() 144LnkProperties::~LnkProperties()
144{ 145{
145} 146}
146 147
147void LnkProperties::unlinkLnk() 148void LnkProperties::unlinkLnk()
148{ 149{
149 if ( QPEMessageBox::confirmDelete( this, tr("Delete"), lnk->name() ) ) { 150 if ( QPEMessageBox::confirmDelete( this, tr("Delete"), lnk->name() ) ) {
150 lnk->removeFiles(); 151 lnk->removeFiles();
151 if ( QFile::exists(lnk->file()) ) { 152 if ( QFile::exists(lnk->file()) ) {
152 QMessageBox::warning( this, tr("Delete"), tr("File deletion failed.") ); 153 QMessageBox::warning( this, tr("Delete"), tr("File deletion failed.") );
153 } else { 154 } else {
154 reject(); 155 reject();
155 } 156 }
156 } 157 }
157} 158}
158 159
159void LnkProperties::setupLocations() 160void LnkProperties::setupLocations()
160{ 161{
161 QFileInfo fi( lnk->file() ); 162 QFileInfo fi( lnk->file() );
162 fileSize = fi.size(); 163 fileSize = fi.size();
163 StorageInfo storage; 164 StorageInfo storage;
164 const QList<FileSystem> &fs = storage.fileSystems(); 165 const QList<FileSystem> &fs = storage.fileSystems();
165 QListIterator<FileSystem> it ( fs ); 166 QListIterator<FileSystem> it ( fs );
166 QString s; 167 QString s;
167 QString homeDir = getenv("HOME"); 168 QString homeDir = getenv("HOME");
168 QString hardDiskHome; 169 QString hardDiskHome;
169 QString hardDiskPath; 170 QString hardDiskPath;
170 int index = 0; 171 int index = 0;
171 currentLocation = -1; 172 currentLocation = -1;
172 for ( ; it.current(); ++it ) { 173 for ( ; it.current(); ++it ) {
173 // we add 10k to the file size so we are sure we can also save the desktop file 174 // we add 10k to the file size so we are sure we can also save the desktop file
174 if ( (ulong)(*it)->availBlocks() * (ulong)(*it)->blockSize() > (ulong)fileSize + 10000 ) { 175 if ( (ulong)(*it)->availBlocks() * (ulong)(*it)->blockSize() > (ulong)fileSize + 10000 ) {
175 if ( (*it)->isRemovable() || 176 if ( (*it)->isRemovable() ||
176 (*it)->disk() == "/dev/mtdblock1" || 177 (*it)->disk() == "/dev/mtdblock1" ||
177 (*it)->disk() == "/dev/mtdblock/1" || 178 (*it)->disk() == "/dev/mtdblock/1" ||
178 (*it)->disk().left(13) == "/dev/mtdblock" || 179 (*it)->disk().left(13) == "/dev/mtdblock" ||
179 (*it)->disk() == "/dev/mtdblock6" || 180 (*it)->disk() == "/dev/mtdblock6" ||
180 (*it )->disk() == "/dev/root" || 181 (*it )->disk() == "/dev/root" ||
181 (*it)->disk() == "tmpfs" ) { 182 (*it)->disk() == "tmpfs" ) {
182 d->locationCombo->insertItem( (*it)->name(), index ); 183 d->locationCombo->insertItem( (*it)->name(), index );
183 locations.append( ( ((*it)->isRemovable() || 184 locations.append( ( ((*it)->isRemovable() ||
184 (*it)->disk() == "/dev/mtdblock6" || 185 (*it)->disk() == "/dev/mtdblock6" ||
185 (*it)->disk() == "tmpfs" ) 186 (*it)->disk() == "tmpfs" )
186 ? (*it)->path() : homeDir) ); 187 ? (*it)->path() : homeDir) );
187 if ( lnk->file().contains( (*it)->path() ) ) { 188 if ( lnk->file().contains( (*it)->path() ) ) {
188 d->locationCombo->setCurrentItem( index ); 189 d->locationCombo->setCurrentItem( index );
189 currentLocation = index; 190 currentLocation = index;
190 } 191 }
191 index++; 192 index++;
192 } else if ( (*it)->name().contains( tr("Hard Disk") ) && 193 } else if ( (*it)->name().contains( tr("Hard Disk") ) &&
193 homeDir.contains( (*it)->path() ) && 194 homeDir.contains( (*it)->path() ) &&
194 (*it)->path().length() > hardDiskHome.length() ) { 195 (*it)->path().length() > hardDiskHome.length() ) {
195 hardDiskHome = (*it)->name(); 196 hardDiskHome = (*it)->name();
196 hardDiskPath = (*it)->path(); 197 hardDiskPath = (*it)->path();
197 } 198 }
198 } 199 }
199 } 200 }
200 if ( !hardDiskHome.isEmpty() ) { 201 if ( !hardDiskHome.isEmpty() ) {
201 d->locationCombo->insertItem( hardDiskHome ); 202 d->locationCombo->insertItem( hardDiskHome );
202 locations.append( hardDiskPath ); 203 locations.append( hardDiskPath );
203 if ( currentLocation == -1 ) { // assume it's the hard disk 204 if ( currentLocation == -1 ) { // assume it's the hard disk
204 d->locationCombo->setCurrentItem( index ); 205 d->locationCombo->setCurrentItem( index );
205 currentLocation = index; 206 currentLocation = index;
206 } 207 }
207 } 208 }
208} 209}
209 210
210void LnkProperties::duplicateLnk() 211void LnkProperties::duplicateLnk()
211{ 212{
212 // The duplicate takes the new properties. 213 // The duplicate takes the new properties.
213 DocLnk newdoc( *((DocLnk *)lnk) ); 214 DocLnk newdoc( *((DocLnk *)lnk) );
214 if ( d->docname->text() == lnk->name() ) 215 if ( d->docname->text() == lnk->name() )
215 newdoc.setName(tr("Copy of ")+d->docname->text()); 216 newdoc.setName(tr("Copy of ")+d->docname->text());
216 else 217 else
217 newdoc.setName(d->docname->text()); 218 newdoc.setName(d->docname->text());
218 219
219 if ( !copyFile( newdoc ) ) { 220 if ( !copyFile( newdoc ) ) {
220 QMessageBox::warning( this, tr("Duplicate"), tr("File copy failed.") ); 221 QMessageBox::warning( this, tr("Duplicate"), tr("File copy failed.") );
221 return; 222 return;
222 } 223 }
223 reject(); 224 reject();
224} 225}
225 226
226bool LnkProperties::moveLnk() 227bool LnkProperties::moveLnk()
227{ 228{
228 DocLnk newdoc( *((DocLnk *)lnk) ); 229 DocLnk newdoc( *((DocLnk *)lnk) );
229 newdoc.setName(d->docname->text()); 230 newdoc.setName(d->docname->text());
230 231
231 if ( !copyFile( newdoc ) ) { 232 if ( !copyFile( newdoc ) ) {
232 QMessageBox::warning( this, tr("Details"), tr("Moving Document failed.") ); 233 QMessageBox::warning( this, tr("Details"), tr("Moving Document failed.") );
233 return FALSE; 234 return FALSE;
234 } 235 }
235 // remove old lnk 236 // remove old lnk
236 lnk->removeFiles(); 237 lnk->removeFiles();
237 238
238 return TRUE; 239 return TRUE;
239} 240}
240 241
241void LnkProperties::beamLnk() 242void LnkProperties::beamLnk()
242{ 243{
243 Ir ir; 244 Ir ir;
244 DocLnk doc( *((DocLnk *)lnk) ); 245 DocLnk doc( *((DocLnk *)lnk) );
245 doc.setName(d->docname->text()); 246 doc.setName(d->docname->text());
246 reject(); 247 reject();
247 ir.send( doc, doc.comment() ); 248 ir.send( doc, doc.comment() );
248} 249}
249 250
251static bool createMimedir(const QString&base,const QString&mimetype)
252{
253 int pos = 0;
254 int stage = 0;
255 if (base.length()==0) return FALSE;
256 QString _tname = base+"/Documents";
257 QDir _dir(_tname+"/"+mimetype);
258 if (_dir.exists()) return TRUE;
259 pos = mimetype.find("/");
260 _dir.setPath(_tname);
261 while (stage<2) {
262 if (!_dir.exists()) {
263 if (!_dir.mkdir(_tname)) {
264 qDebug( QString("Creation of dir %1 failed\n").arg(_tname));
265 return FALSE;
266 }
267 }
268 switch(stage) {
269 case 0:
270 _tname+="/"+mimetype.left(pos);
271 break;
272 case 1:
273 _tname+="/"+mimetype.right(pos-1);
274 break;
275 default:
276 break;
277 }
278 _dir.setPath(_tname);
279 ++stage;
280 }
281 return TRUE;
282}
283
250bool LnkProperties::copyFile( DocLnk &newdoc ) 284bool LnkProperties::copyFile( DocLnk &newdoc )
251{ 285{
252 const char *linkExtn = ".desktop"; 286 const char *linkExtn = ".desktop";
253 QString fileExtn; 287 QString fileExtn;
254 int extnPos = lnk->file().findRev( '.' ); 288 int extnPos = lnk->file().findRev( '.' );
255 if ( extnPos > 0 ) 289 if ( extnPos > 0 )
256 fileExtn = lnk->file().mid( extnPos ); 290 fileExtn = lnk->file().mid( extnPos );
257 291
258 QString safename = newdoc.name(); 292 QString safename = newdoc.name();
259 safename.replace(QRegExp("/"),"_"); 293 safename.replace(QRegExp("/"),"_");
260 294
261 QString fn = locations[ d->locationCombo->currentItem() ] 295 QString fn = locations[ d->locationCombo->currentItem() ]
262 + "/Documents/" + newdoc.type() + "/" + safename; 296 + "/Documents/" + newdoc.type();
297 if (!createMimedir(locations[ d->locationCombo->currentItem() ],newdoc.type())) {
298 return FALSE;
299 }
300 fn+="/"+safename;
263 if ( QFile::exists(fn + fileExtn) || QFile::exists(fn + linkExtn) ) { 301 if ( QFile::exists(fn + fileExtn) || QFile::exists(fn + linkExtn) ) {
264 int n=1; 302 int n=1;
265 QString nn = fn + "_" + QString::number(n); 303 QString nn = fn + "_" + QString::number(n);
266 while ( QFile::exists(nn+fileExtn) || QFile::exists(nn+linkExtn) ) { 304 while ( QFile::exists(nn+fileExtn) || QFile::exists(nn+linkExtn) ) {
267 n++; 305 n++;
268 nn = fn + "_" + QString::number(n); 306 nn = fn + "_" + QString::number(n);
269 } 307 }
270 fn = nn; 308 fn = nn;
271 } 309 }
272 newdoc.setFile( fn + fileExtn ); 310 newdoc.setFile( fn + fileExtn );
273 newdoc.setLinkFile( fn + linkExtn ); 311 newdoc.setLinkFile( fn + linkExtn );
274 312
275 // Copy file 313 // Copy file
276 FileManager fm; 314 FileManager fm;
277 if ( !fm.copyFile( *lnk, newdoc ) ) 315 if ( !fm.copyFile( *lnk, newdoc ) )
278 return FALSE; 316 return FALSE;
279 return TRUE; 317 return TRUE;
280} 318}
281 319
282void LnkProperties::done(int ok) 320void LnkProperties::done(int ok)
283{ 321{
284 if ( ok ) { 322 if ( ok ) {
285 bool changed=FALSE; 323 bool changed=FALSE;
286 bool reloadMime=FALSE; 324 bool reloadMime=FALSE;
287 325
288 if ( lnk->name() != d->docname->text() ) { 326 if ( lnk->name() != d->docname->text() ) {
289 lnk->setName(d->docname->text()); 327 lnk->setName(d->docname->text());
290 changed=TRUE; 328 changed=TRUE;
291 } 329 }
292 if ( d->categoryEdit->isVisible() ) { 330 if ( d->categoryEdit->isVisible() ) {
293 QArray<int> tmp = d->categoryEdit->newCategories(); 331 QArray<int> tmp = d->categoryEdit->newCategories();
294 if ( lnk->categories() != tmp ) { 332 if ( lnk->categories() != tmp ) {
295 lnk->setCategories( tmp ); 333 lnk->setCategories( tmp );
296 changed = TRUE; 334 changed = TRUE;
297 } 335 }
298 } 336 }
299 if ( !d->rotate->isHidden()) { 337 if ( !d->rotate->isHidden()) {
300 QString newrot; 338 QString newrot;
301 339
302 if ( d->rotate->isChecked() ) { 340 if ( d->rotate->isChecked() ) {
303 int rot=0; 341 int rot=0;
304 for(; rot<4; rot++) { 342 for(; rot<4; rot++) {
305 if (d->rotateButtons->find(rot)->isOn()) 343 if (d->rotateButtons->find(rot)->isOn())
306 break; 344 break;
307 } 345 }
308 newrot = QString::number((rot*90)%360); 346 newrot = QString::number((rot*90)%360);
309 } 347 }
310 if ( newrot != lnk->rotation() ) { 348 if ( newrot != lnk->rotation() ) {
311 lnk-> setRotation(newrot); 349 lnk-> setRotation(newrot);
312 changed = TRUE; 350 changed = TRUE;
313 reloadMime = TRUE; 351 reloadMime = TRUE;
314 } 352 }
315 } 353 }
316 if ( d->arguments->text() != lnk->property( "Arguments" ) ) { 354 if ( d->arguments->text() != lnk->property( "Arguments" ) ) {
317 lnk->setProperty( "Arguments", d->arguments->text() ); 355 lnk->setProperty( "Arguments", d->arguments->text() );
318 changed = TRUE; 356 changed = TRUE;
319 } 357 }
320 if ( d->preload->isHidden() && d->locationCombo->currentItem() != currentLocation ) { 358 if ( d->preload->isHidden() && d->locationCombo->currentItem() != currentLocation ) {
321 moveLnk(); 359 moveLnk();
322 } else if ( changed ) { 360 } else if ( changed ) {
323 lnk->writeLink(); 361 lnk->writeLink();
324 } 362 }
325 363
326 if ( !d->preload->isHidden() ) { 364 if ( !d->preload->isHidden() ) {
327 Config cfg("Launcher"); 365 Config cfg("Launcher");
328 cfg.setGroup("Preload"); 366 cfg.setGroup("Preload");
329 QStringList apps = cfg.readListEntry("Apps",','); 367 QStringList apps = cfg.readListEntry("Apps",',');
330 QString exe = lnk->exec(); 368 QString exe = lnk->exec();
331 if ( apps.contains(exe) != d->preload->isChecked() ) { 369 if ( apps.contains(exe) != d->preload->isChecked() ) {
332 if ( d->preload->isChecked() ) { 370 if ( d->preload->isChecked() ) {
333 apps.append(exe); 371 apps.append(exe);
334#ifndef QT_NO_COP 372#ifndef QT_NO_COP
335 QCopEnvelope e("QPE/Application/"+exe.local8Bit(), 373 QCopEnvelope e("QPE/Application/"+exe.local8Bit(),
336 "enablePreload()"); 374 "enablePreload()");
337#endif 375#endif
338 } else { 376 } else {
339 apps.remove(exe); 377 apps.remove(exe);
340#ifndef QT_NO_COP 378#ifndef QT_NO_COP
341 QCopEnvelope e("QPE/Application/"+exe.local8Bit(), 379 QCopEnvelope e("QPE/Application/"+exe.local8Bit(),
342 "quitIfInvisible()"); 380 "quitIfInvisible()");
343#endif 381#endif
344 } 382 }
345 cfg.writeEntry("Apps",apps,','); 383 cfg.writeEntry("Apps",apps,',');
346 } 384 }
347 } 385 }
348 if ( reloadMime ) 386 if ( reloadMime )
349 MimeType::updateApplications ( ); 387 MimeType::updateApplications ( );
350 } 388 }
351 QDialog::done( ok ); 389 QDialog::done( ok );
352} 390}
353 391