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