-rw-r--r-- | noncore/settings/tabmanager/tabmanager.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/settings/tabmanager/tabmanager.cpp b/noncore/settings/tabmanager/tabmanager.cpp index 3eae424..85e5814 100644 --- a/noncore/settings/tabmanager/tabmanager.cpp +++ b/noncore/settings/tabmanager/tabmanager.cpp | |||
@@ -1,120 +1,120 @@ | |||
1 | #include "tabmanager.h" | 1 | #include "tabmanager.h" |
2 | #include "app.h" | 2 | #include "app.h" |
3 | #include "wait.h" | 3 | #include "wait.h" |
4 | #include "tabapplnk.h" | 4 | #include "tabapplnk.h" |
5 | 5 | ||
6 | #include <opie2/odebug.h> | 6 | #include <opie2/odebug.h> |
7 | 7 | ||
8 | #include <qpe/applnk.h> | 8 | #include <qpe/applnk.h> |
9 | #include <qdir.h> | 9 | #include <qdir.h> |
10 | #include <qfile.h> | 10 | #include <qfile.h> |
11 | #include <qtextstream.h> | 11 | #include <qtextstream.h> |
12 | #include <qlistview.h> | 12 | #include <qlistview.h> |
13 | #include <qheader.h> | 13 | #include <qheader.h> |
14 | #include <qcombobox.h> | 14 | #include <qcombobox.h> |
15 | #include <qlineedit.h> | 15 | #include <qlineedit.h> |
16 | #include <qlabel.h> | 16 | #include <qlabel.h> |
17 | #include <qmessagebox.h> | 17 | #include <qmessagebox.h> |
18 | #include <stdlib.h> | 18 | #include <stdlib.h> |
19 | #include <qpe/qcopenvelope_qws.h> | 19 | #include <qpe/qcopenvelope_qws.h> |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | 22 | ||
23 | 23 | ||
24 | #define HOME_APP_DIR QPEApplication::qpeDir()+"/apps" | 24 | #define HOME_APP_DIR QPEApplication::qpeDir()+"apps" |
25 | #define HOME_APP_INSTALL_DIR "/usr/lib/ipkg/info" | 25 | #define HOME_APP_INSTALL_DIR "/usr/lib/ipkg/info" |
26 | #define NEW_FOLDER "EmptyTab" | 26 | #define NEW_FOLDER "EmptyTab" |
27 | #define NEW_APPLICATION "NewApp" | 27 | #define NEW_APPLICATION "NewApp" |
28 | #define APPLICATION_EXTENSION ".desktop" | 28 | #define APPLICATION_EXTENSION ".desktop" |
29 | #define APPLICATION_EXTENSION_LENGTH 8 | 29 | #define APPLICATION_EXTENSION_LENGTH 8 |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * Constructor. Sets up signals. Performs initial scan of applications | 32 | * Constructor. Sets up signals. Performs initial scan of applications |
33 | * and tabs | 33 | * and tabs |
34 | */ | 34 | */ |
35 | TabManager::TabManager( QWidget* parent, const char* name):TabManagerBase(parent, name), changed(false), application(NULL){ | 35 | TabManager::TabManager( QWidget* parent, const char* name):TabManagerBase(parent, name), changed(false), application(NULL){ |
36 | rescanFolder(HOME_APP_DIR); | 36 | rescanFolder(HOME_APP_DIR); |
37 | 37 | ||
38 | // Connect the signals and slots | 38 | // Connect the signals and slots |
39 | connect(tabList, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(editItem(QListViewItem*))); | 39 | connect(tabList, SIGNAL(doubleClicked(QListViewItem*)), this, SLOT(editItem(QListViewItem*))); |
40 | (tabList->header())->hide(); | 40 | (tabList->header())->hide(); |
41 | connect(tabList, SIGNAL(moveItem(QListViewItem*,QListViewItem*)), this, SLOT(moveApplication(QListViewItem*,QListViewItem*))); | 41 | connect(tabList, SIGNAL(moveItem(QListViewItem*,QListViewItem*)), this, SLOT(moveApplication(QListViewItem*,QListViewItem*))); |
42 | } | 42 | } |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * If anything in the tab's have been changed then update the system or alert | 45 | * If anything in the tab's have been changed then update the system or alert |
46 | * the user. | 46 | * the user. |
47 | */ | 47 | */ |
48 | TabManager::~TabManager(){ | 48 | TabManager::~TabManager(){ |
49 | if(changed){ | 49 | if(changed){ |
50 | // Prompt. | 50 | // Prompt. |
51 | //int answer = QMessageBox::warning(this, "Message", "Should your desktop be","Yes", "Cancel", 0, 1 ); | 51 | //int answer = QMessageBox::warning(this, "Message", "Should your desktop be","Yes", "Cancel", 0, 1 ); |
52 | //if (answer) | 52 | //if (answer) |
53 | // return; | 53 | // return; |
54 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 54 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
55 | QString link; //we'll just send an empty string | 55 | QString link; //we'll just send an empty string |
56 | e << link; | 56 | e << link; |
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * Scans root directory for any tabs or applications. Will recursivly go down, | 61 | * Scans root directory for any tabs or applications. Will recursivly go down, |
62 | * but will not follow symlinks. | 62 | * but will not follow symlinks. |
63 | * @param directory - the directory to look in. | 63 | * @param directory - the directory to look in. |
64 | * @param parent - the parent to place any new tabs or apps into. If parent is | 64 | * @param parent - the parent to place any new tabs or apps into. If parent is |
65 | * NULL then the item is a tab and should be placed as a child of the window. | 65 | * NULL then the item is a tab and should be placed as a child of the window. |
66 | */ | 66 | */ |
67 | void TabManager::rescanFolder(QString directory, QListViewItem* parent){ | 67 | void TabManager::rescanFolder(QString directory, QListViewItem* parent){ |
68 | //odebug << QString("rescanFolder: ") + directory.latin1() << oendl; | 68 | //odebug << QString("rescanFolder: ") + directory.latin1() << oendl; |
69 | 69 | ||
70 | QDir d; | 70 | QDir d; |
71 | d.setPath(directory); | 71 | d.setPath(directory); |
72 | // Show hidden files for .directories | 72 | // Show hidden files for .directories |
73 | d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs); | 73 | d.setFilter( QDir::Files | QDir::Hidden | QDir::Dirs); |
74 | 74 | ||
75 | const QFileInfoList *list = d.entryInfoList(); | 75 | const QFileInfoList *list = d.entryInfoList(); |
76 | QFileInfoListIterator it( *list ); // create list iterator | 76 | QFileInfoListIterator it( *list ); // create list iterator |
77 | QFileInfo *fi; // pointer for traversing | 77 | QFileInfo *fi; // pointer for traversing |
78 | 78 | ||
79 | while ( (fi=it.current()) ) { // for each file... | 79 | while ( (fi=it.current()) ) { // for each file... |
80 | // If it is a dir and not .. or . then add it as a tab and go down. | 80 | // If it is a dir and not .. or . then add it as a tab and go down. |
81 | if(fi->isDir()){ | 81 | if(fi->isDir()){ |
82 | if(fi->fileName() != ".." && fi->fileName() != ".") { | 82 | if(fi->fileName() != ".." && fi->fileName() != ".") { |
83 | QListViewItem* newItem; | 83 | QListViewItem* newItem; |
84 | if(!parent) | 84 | if(!parent) |
85 | newItem = new QListViewItem(tabList, fi->fileName()); | 85 | newItem = new QListViewItem(tabList, fi->fileName()); |
86 | else | 86 | else |
87 | newItem = new QListViewItem(parent, fi->fileName()); | 87 | newItem = new QListViewItem(parent, fi->fileName()); |
88 | itemList.insert(newItem, directory + "/" + fi->fileName() + "/.directory" ); | 88 | itemList.insert(newItem, directory + "/" + fi->fileName() + "/.directory" ); |
89 | rescanFolder(directory + "/" + fi->fileName(), newItem); | 89 | rescanFolder(directory + "/" + fi->fileName(), newItem); |
90 | } | 90 | } |
91 | } | 91 | } |
92 | else{ | 92 | else{ |
93 | // it is a file, if not a .directory add to parent. | 93 | // it is a file, if not a .directory add to parent. |
94 | 94 | ||
95 | // Change parents name and icon to reflect icon. | 95 | // Change parents name and icon to reflect icon. |
96 | if(fi->fileName() == ".directory"){ | 96 | if(fi->fileName() == ".directory"){ |
97 | AppLnk app(directory + "/" + fi->fileName()); | 97 | AppLnk app(directory + "/" + fi->fileName()); |
98 | if(parent){ | 98 | if(parent){ |
99 | parent->setPixmap(0,app.pixmap()); | 99 | parent->setPixmap(0,app.pixmap()); |
100 | parent->setText(0, app.name()); | 100 | parent->setText(0, app.name()); |
101 | } | 101 | } |
102 | } | 102 | } |
103 | else{ | 103 | else{ |
104 | // Add any desktop files found. | 104 | // Add any desktop files found. |
105 | QListViewItem* newItem; | 105 | QListViewItem* newItem; |
106 | if(directory != HOME_APP_DIR){ | 106 | if(directory != HOME_APP_DIR){ |
107 | if(!parent) | 107 | if(!parent) |
108 | newItem = new QListViewItem(tabList, fi->fileName()); | 108 | newItem = new QListViewItem(tabList, fi->fileName()); |
109 | else | 109 | else |
110 | newItem = new QListViewItem(parent, fi->fileName()); | 110 | newItem = new QListViewItem(parent, fi->fileName()); |
111 | if(fi->fileName().right(APPLICATION_EXTENSION_LENGTH) == APPLICATION_EXTENSION){ | 111 | if(fi->fileName().right(APPLICATION_EXTENSION_LENGTH) == APPLICATION_EXTENSION){ |
112 | AppLnk app(directory + "/" + fi->fileName()); | 112 | AppLnk app(directory + "/" + fi->fileName()); |
113 | newItem->setPixmap(0,app.pixmap()); | 113 | newItem->setPixmap(0,app.pixmap()); |
114 | newItem->setText(0, app.name()); | 114 | newItem->setText(0, app.name()); |
115 | itemList.insert(newItem, directory + "/" + fi->fileName()); | 115 | itemList.insert(newItem, directory + "/" + fi->fileName()); |
116 | } | 116 | } |
117 | } | 117 | } |
118 | } | 118 | } |
119 | } | 119 | } |
120 | ++it; // goto next list element | 120 | ++it; // goto next list element |
@@ -165,193 +165,193 @@ void TabManager::newApplication(){ | |||
165 | itemList.insert(newItem, homeLocation ); | 165 | itemList.insert(newItem, homeLocation ); |
166 | 166 | ||
167 | // We have changed something. | 167 | // We have changed something. |
168 | changed = true; | 168 | changed = true; |
169 | } | 169 | } |
170 | 170 | ||
171 | /** | 171 | /** |
172 | * Remove the item. | 172 | * Remove the item. |
173 | * Check if we can | 173 | * Check if we can |
174 | * Prompt user | 174 | * Prompt user |
175 | * Delete physical file (Dir, remove .dir, then dir. File, remove file) | 175 | * Delete physical file (Dir, remove .dir, then dir. File, remove file) |
176 | * Remove from installer if need too. | 176 | * Remove from installer if need too. |
177 | */ | 177 | */ |
178 | void TabManager::removeItem(){ | 178 | void TabManager::removeItem(){ |
179 | // Make sure we can delete | 179 | // Make sure we can delete |
180 | QListViewItem *item = tabList->currentItem(); | 180 | QListViewItem *item = tabList->currentItem(); |
181 | if(!item) | 181 | if(!item) |
182 | return; | 182 | return; |
183 | if(item->childCount() > 0){ | 183 | if(item->childCount() > 0){ |
184 | QMessageBox::critical(this, tr("Message"), tr("Can't remove with applications\nstill in the group."), tr("Ok") ); | 184 | QMessageBox::critical(this, tr("Message"), tr("Can't remove with applications\nstill in the group."), tr("Ok") ); |
185 | return; | 185 | return; |
186 | } | 186 | } |
187 | 187 | ||
188 | // Prompt. | 188 | // Prompt. |
189 | int answer = QMessageBox::warning(this, tr("Message"), tr("Are you sure you want to delete?"), tr("Yes"), tr("Cancel"), 0, 1 ); | 189 | int answer = QMessageBox::warning(this, tr("Message"), tr("Are you sure you want to delete?"), tr("Yes"), tr("Cancel"), 0, 1 ); |
190 | if (answer) | 190 | if (answer) |
191 | return; | 191 | return; |
192 | 192 | ||
193 | bool removeSuccessful = true; | 193 | bool removeSuccessful = true; |
194 | QString location = itemList[item]; | 194 | QString location = itemList[item]; |
195 | // Remove file (.directory in a Directory case) | 195 | // Remove file (.directory in a Directory case) |
196 | if(!QFile::remove(location)) | 196 | if(!QFile::remove(location)) |
197 | removeSuccessful = false; | 197 | removeSuccessful = false; |
198 | 198 | ||
199 | // Remove directory | 199 | // Remove directory |
200 | if(item->parent() == NULL){ | 200 | if(item->parent() == NULL){ |
201 | // Remove .directory file string | 201 | // Remove .directory file string |
202 | location = location.mid(0,location.length()-10); | 202 | location = location.mid(0,location.length()-10); |
203 | QDir dir; | 203 | QDir dir; |
204 | if(!dir.rmdir(location)) | 204 | if(!dir.rmdir(location)) |
205 | removeSuccessful = false; | 205 | removeSuccessful = false; |
206 | else | 206 | else |
207 | removeSuccessful = true; | 207 | removeSuccessful = true; |
208 | } | 208 | } |
209 | 209 | ||
210 | // If removing failed. | 210 | // If removing failed. |
211 | if(!removeSuccessful){ | 211 | if(!removeSuccessful){ |
212 | odebug << (QString("removeItem: ") + location).latin1() << oendl; | 212 | odebug << (QString("removeItem: ") + location).latin1() << oendl; |
213 | QMessageBox::critical(this, tr("Message"), tr("Can't remove."), tr("Ok") ); | 213 | QMessageBox::critical(this, tr("Message"), tr("Can't remove."), tr("Ok") ); |
214 | return; | 214 | return; |
215 | } | 215 | } |
216 | 216 | ||
217 | // Remove from the installer so it wont fail. | 217 | // Remove from the installer so it wont fail. |
218 | // Don't need to do this sense the current install uses rm -f so no error | 218 | // Don't need to do this sense the current install uses rm -f so no error |
219 | 219 | ||
220 | // Remove from the gui list. | 220 | // Remove from the gui list. |
221 | itemList.remove(item); | 221 | itemList.remove(item); |
222 | if(item->parent()) | 222 | if(item->parent()) |
223 | item->parent()->takeItem(item); | 223 | item->parent()->takeItem(item); |
224 | delete item; | 224 | delete item; |
225 | 225 | ||
226 | // We have changed something. | 226 | // We have changed something. |
227 | changed = true; | 227 | changed = true; |
228 | } | 228 | } |
229 | 229 | ||
230 | /** | 230 | /** |
231 | * Helper function. Edits the current item. | 231 | * Helper function. Edits the current item. |
232 | * calls editItem with the currently selected item. | 232 | * calls editItem with the currently selected item. |
233 | */ | 233 | */ |
234 | void TabManager::editCurrentItem(){ | 234 | void TabManager::editCurrentItem(){ |
235 | editItem(tabList->currentItem()); | 235 | editItem(tabList->currentItem()); |
236 | } | 236 | } |
237 | 237 | ||
238 | /** | 238 | /** |
239 | * Edit the item that is passed in. | 239 | * Edit the item that is passed in. |
240 | * Show application dialog and if anything changed | 240 | * Show application dialog and if anything changed |
241 | * @param item the item to edit. | 241 | * @param item the item to edit. |
242 | */ | 242 | */ |
243 | void TabManager::editItem( QListViewItem * item){ | 243 | void TabManager::editItem( QListViewItem * item){ |
244 | if(!item) | 244 | if(!item) |
245 | return; | 245 | return; |
246 | 246 | ||
247 | TabAppLnk app(itemList[item]); | 247 | TabAppLnk app(itemList[item]); |
248 | if(!app.isValid()){ | 248 | if(!app.isValid()){ |
249 | odebug << QString("editItem: Not a valid applnk file: ") + itemList[item].latin1() << oendl; | 249 | odebug << QString("editItem: Not a valid applnk file: ") + itemList[item].latin1() << oendl; |
250 | return; | 250 | return; |
251 | } | 251 | } |
252 | 252 | ||
253 | // Fill with all of the icons | 253 | // Fill with all of the icons |
254 | if(!application){ | 254 | if(!application){ |
255 | Wait waitDialog(this, "Wait dialog"); | 255 | Wait waitDialog(this, "Wait dialog"); |
256 | waitDialog.waitLabel->setText(tr("Gathering icons...")); | 256 | waitDialog.waitLabel->setText(tr("Gathering icons...")); |
257 | waitDialog.show(); | 257 | waitDialog.show(); |
258 | qApp->processEvents(); | 258 | qApp->processEvents(); |
259 | application = new AppEdit(this, "Application edit", true); | 259 | application = new AppEdit(this, "Application edit", true); |
260 | 260 | ||
261 | QDir d(QPEApplication::qpeDir() + "/pics/"); | 261 | QDir d(QPEApplication::qpeDir() + "pics/"); |
262 | d.setFilter( QDir::Files); | 262 | d.setFilter( QDir::Files); |
263 | 263 | ||
264 | const QFileInfoList *list = d.entryInfoList(); | 264 | const QFileInfoList *list = d.entryInfoList(); |
265 | QFileInfoListIterator it( *list ); // create list iterator | 265 | QFileInfoListIterator it( *list ); // create list iterator |
266 | QFileInfo *fi; // pointer for traversing | 266 | QFileInfo *fi; // pointer for traversing |
267 | 267 | ||
268 | while ( (fi=it.current()) ) { // for each file... | 268 | while ( (fi=it.current()) ) { // for each file... |
269 | QString fileName = fi->fileName(); | 269 | QString fileName = fi->fileName(); |
270 | if(fileName.right(4) == ".png"){ | 270 | if(fileName.right(4) == ".png"){ |
271 | fileName = fileName.mid(0,fileName.length()-4); | 271 | fileName = fileName.mid(0,fileName.length()-4); |
272 | QPixmap imageOfFile(Resource::loadPixmap(fileName)); | 272 | QPixmap imageOfFile(Resource::loadPixmap(fileName)); |
273 | QImage foo = imageOfFile.convertToImage(); | 273 | QImage foo = imageOfFile.convertToImage(); |
274 | foo = foo.smoothScale(16,16); | 274 | foo = foo.smoothScale(16,16); |
275 | imageOfFile.convertFromImage(foo); | 275 | imageOfFile.convertFromImage(foo); |
276 | application->iconLineEdit->insertItem(imageOfFile,fileName); | 276 | application->iconLineEdit->insertItem(imageOfFile,fileName); |
277 | } | 277 | } |
278 | //odebug << fi->fileName().latin1() << oendl; | 278 | //odebug << fi->fileName().latin1() << oendl; |
279 | ++it; | 279 | ++it; |
280 | } | 280 | } |
281 | waitDialog.hide(); | 281 | waitDialog.hide(); |
282 | } | 282 | } |
283 | int pixmap = -1; | 283 | int pixmap = -1; |
284 | QString pixmapText = app.pixmapString(); | 284 | QString pixmapText = app.pixmapString(); |
285 | QComboBox *f = application->iconLineEdit; | 285 | QComboBox *f = application->iconLineEdit; |
286 | for(int i = 0; i < application->iconLineEdit->count(); i++){ | 286 | for(int i = 0; i < application->iconLineEdit->count(); i++){ |
287 | if(f->text(i) == pixmapText){ | 287 | if(f->text(i) == pixmapText){ |
288 | pixmap = i; | 288 | pixmap = i; |
289 | break; | 289 | break; |
290 | } | 290 | } |
291 | } | 291 | } |
292 | if(pixmap != -1) | 292 | if(pixmap != -1) |
293 | application->iconLineEdit->setCurrentItem(pixmap); | 293 | application->iconLineEdit->setCurrentItem(pixmap); |
294 | else if(pixmapText.isEmpty()){ | 294 | else if(pixmapText.isEmpty()){ |
295 | application->iconLineEdit->setCurrentItem(0); | 295 | application->iconLineEdit->setCurrentItem(0); |
296 | } | 296 | } |
297 | else{ | 297 | else{ |
298 | QPixmap imageOfFile(Resource::loadPixmap(pixmapText)); | 298 | QPixmap imageOfFile(Resource::loadPixmap(pixmapText)); |
299 | QImage foo = imageOfFile.convertToImage(); | 299 | QImage foo = imageOfFile.convertToImage(); |
300 | foo = foo.smoothScale(16,16); | 300 | foo = foo.smoothScale(16,16); |
301 | imageOfFile.convertFromImage(foo); | 301 | imageOfFile.convertFromImage(foo); |
302 | application->iconLineEdit->insertItem(imageOfFile,pixmapText,0); | 302 | application->iconLineEdit->insertItem(imageOfFile,pixmapText,0); |
303 | application->iconLineEdit->setCurrentItem(0); | 303 | application->iconLineEdit->setCurrentItem(0); |
304 | } | 304 | } |
305 | 305 | ||
306 | application->nameLineEdit->setText(app.name()); | 306 | application->nameLineEdit->setText(app.name()); |
307 | application->execLineEdit->setText(app.exec()); | 307 | application->execLineEdit->setText(app.exec()); |
308 | application->commentLineEdit->setText(app.comment()); | 308 | application->commentLineEdit->setText(app.comment()); |
309 | 309 | ||
310 | if(item->parent() == NULL){ | 310 | if(item->parent() == NULL){ |
311 | application->execLineEdit->setEnabled(false); | 311 | application->execLineEdit->setEnabled(false); |
312 | application->TextLabel3->setEnabled(false); | 312 | application->TextLabel3->setEnabled(false); |
313 | application->setCaption(tr("Tab")); | 313 | application->setCaption(tr("Tab")); |
314 | } | 314 | } |
315 | else{ | 315 | else{ |
316 | application->execLineEdit->setEnabled(true); | 316 | application->execLineEdit->setEnabled(true); |
317 | application->TextLabel3->setEnabled(true); | 317 | application->TextLabel3->setEnabled(true); |
318 | application->setCaption(tr("Application")); | 318 | application->setCaption(tr("Application")); |
319 | } | 319 | } |
320 | 320 | ||
321 | // Only do somthing if they hit OK | 321 | // Only do somthing if they hit OK |
322 | application->showMaximized(); | 322 | application->showMaximized(); |
323 | if(application->exec() == 0) | 323 | if(application->exec() == 0) |
324 | return; | 324 | return; |
325 | 325 | ||
326 | // If nothing has changed exit (hmmm why did they hit ok?) | 326 | // If nothing has changed exit (hmmm why did they hit ok?) |
327 | if(app.name() == application->nameLineEdit->text() && | 327 | if(app.name() == application->nameLineEdit->text() && |
328 | app.pixmapString() == application->iconLineEdit->currentText() && | 328 | app.pixmapString() == application->iconLineEdit->currentText() && |
329 | app.comment() == application->commentLineEdit->text() && | 329 | app.comment() == application->commentLineEdit->text() && |
330 | app.exec() == application->execLineEdit->text()) | 330 | app.exec() == application->execLineEdit->text()) |
331 | return; | 331 | return; |
332 | 332 | ||
333 | // Change the applnk file | 333 | // Change the applnk file |
334 | QString oldName = app.name(); | 334 | QString oldName = app.name(); |
335 | app.setName(application->nameLineEdit->text()); | 335 | app.setName(application->nameLineEdit->text()); |
336 | app.setIcon(application->iconLineEdit->currentText()); | 336 | app.setIcon(application->iconLineEdit->currentText()); |
337 | app.setComment(application->commentLineEdit->text()); | 337 | app.setComment(application->commentLineEdit->text()); |
338 | app.setExec(application->execLineEdit->text()); | 338 | app.setExec(application->execLineEdit->text()); |
339 | if(!app.writeLink()){ | 339 | if(!app.writeLink()){ |
340 | QMessageBox::critical(this, tr("Message"), "Can't save.", tr("Ok") ); | 340 | QMessageBox::critical(this, tr("Message"), "Can't save.", tr("Ok") ); |
341 | return; | 341 | return; |
342 | } | 342 | } |
343 | 343 | ||
344 | // Update the gui icon and name | 344 | // Update the gui icon and name |
345 | item->setText(0,app.name()); | 345 | item->setText(0,app.name()); |
346 | item->setPixmap(0,app.pixmap()); | 346 | item->setPixmap(0,app.pixmap()); |
347 | 347 | ||
348 | // We have changed something. | 348 | // We have changed something. |
349 | changed = true; | 349 | changed = true; |
350 | 350 | ||
351 | // If we were dealing with a new folder or new application change | 351 | // If we were dealing with a new folder or new application change |
352 | // the file names. Also change the item location in itemList | 352 | // the file names. Also change the item location in itemList |
353 | if(oldName == NEW_FOLDER){ | 353 | if(oldName == NEW_FOLDER){ |
354 | QDir r; | 354 | QDir r; |
355 | QString oldName = itemList[item]; | 355 | QString oldName = itemList[item]; |
356 | oldName = oldName.mid(0,oldName.length()-11); | 356 | oldName = oldName.mid(0,oldName.length()-11); |
357 | QString newName = oldName.mid(0,oldName.length()-9); | 357 | QString newName = oldName.mid(0,oldName.length()-9); |