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