summaryrefslogtreecommitdiff
path: root/noncore/settings
authorllornkcor <llornkcor>2002-05-06 19:00:18 (UTC)
committer llornkcor <llornkcor>2002-05-06 19:00:18 (UTC)
commitd1dd3ae2eb11a9c6e83eaad817a6f84a53d68691 (patch) (unidiff)
tree190c870ef6cae2ca27c71e75d84e828174c8f000 /noncore/settings
parent26c522550dc1736a463efbe8c1cdc19f83a85f5d (diff)
downloadopie-d1dd3ae2eb11a9c6e83eaad817a6f84a53d68691.zip
opie-d1dd3ae2eb11a9c6e83eaad817a6f84a53d68691.tar.gz
opie-d1dd3ae2eb11a9c6e83eaad817a6f84a53d68691.tar.bz2
added translation stuff
Diffstat (limited to 'noncore/settings') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/tabmanager/tabmanager.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/noncore/settings/tabmanager/tabmanager.cpp b/noncore/settings/tabmanager/tabmanager.cpp
index db65d26..af76251 100644
--- a/noncore/settings/tabmanager/tabmanager.cpp
+++ b/noncore/settings/tabmanager/tabmanager.cpp
@@ -50,36 +50,38 @@
50#define NEW_APPLICATION "NewApp" 50#define NEW_APPLICATION "NewApp"
51#define APPLICATION_EXTENSION ".desktop" 51#define APPLICATION_EXTENSION ".desktop"
52#define APPLICATION_EXTENSION_LENGTH 8 52#define APPLICATION_EXTENSION_LENGTH 8
53 53
54/** 54/**
55 * Constructor. Sets up signals. Performs initial scan of applications 55 * Constructor. Sets up signals. Performs initial scan of applications
56 * and tabs 56 * and tabs
57 */ 57 */
58TabManager::TabManager( QWidget* parent, const char* name):TabManagerBase(parent, name), changed(false){ 58TabManager::TabManager( QWidget* parent, const char* name):TabManagerBase(parent, name), changed(false){
59 rescanFolder(HOME_APP_DIR); 59 rescanFolder(HOME_APP_DIR);
60 60
61 // Connect the signals and slots 61 // Connect the signals and slots
62 connect(tabList, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(editItem(QListViewItem*))); 62 connect(tabList, SIGNAL(doubleClicked(QListViewItem *)),
63 this, SLOT(editItem(QListViewItem*)));
63 (tabList->header())->hide(); 64 (tabList->header())->hide();
64 connect(tabList, SIGNAL(moveItem(QListViewItem *, QListViewItem *)), this, SLOT(moveApplication(QListViewItem *, QListViewItem *))); 65 connect(tabList, SIGNAL(moveItem(QListViewItem *, QListViewItem *)),
66 this, SLOT(moveApplication(QListViewItem *, QListViewItem *)));
65} 67}
66 68
67/** 69/**
68 * If anything in the tab's have been changed then update the system or alert 70 * If anything in the tab's have been changed then update the system or alert
69 * the user. 71 * the user.
70 */ 72 */
71TabManager::~TabManager(){ 73TabManager::~TabManager(){
72 if(changed){ 74 if(changed){
73 //QMessageBox::critical(this, "Message", "Please restart Qtopia to see all new changes.",QString("Ok") ); 75 //QMessageBox::critical(this, tr("Message"), tr("Please restart Qtopia to see all new changes."),tr("Ok") );
74 //filename = fn; 76 //filename = fn;
75 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 77 QCopEnvelope e("QPE/System", "linkChanged(QString)");
76 //e << description << filename << mimetype; 78 //e << description << filename << mimetype;
77 QString link; //we'll just send an empty string 79 QString link; //we'll just send an empty string
78 e << link; 80 e << link;
79 } 81 }
80} 82}
81 83
82/** 84/**
83 * Scans root directory for any tabs or applications. Will recursivly go down, 85 * Scans root directory for any tabs or applications. Will recursivly go down,
84 * but will not follow symlinks. 86 * but will not follow symlinks.
85 * @param directory - the directory to look in. 87 * @param directory - the directory to look in.
@@ -194,52 +196,55 @@ void TabManager::newApplication(){
194 * Remove the item. 196 * Remove the item.
195 * Check if we can 197 * Check if we can
196 * Prompt user 198 * Prompt user
197 * Delete physical file (Dir, remove .dir, then dir. File, remove file) 199 * Delete physical file (Dir, remove .dir, then dir. File, remove file)
198 * Remove from installer if need too. 200 * Remove from installer if need too.
199 */ 201 */
200void TabManager::removeItem(){ 202void TabManager::removeItem(){
201 // Make sure we can delete 203 // Make sure we can delete
202 QListViewItem *item = tabList->currentItem(); 204 QListViewItem *item = tabList->currentItem();
203 if(!item) 205 if(!item)
204 return; 206 return;
205 if(item->childCount() > 0){ 207 if(item->childCount() > 0){
206 QMessageBox::critical(this, "Message", "Can't remove with applications\nstill in the group.",QString("Ok") ); 208 QMessageBox::critical(this, tr("Message"), tr("Can't remove with applications\nstill in the group."),
209 tr("Ok") );
207 return; 210 return;
208 } 211 }
209 212
210 // Prompt. 213 // Prompt.
211 int answer = QMessageBox::warning(this, "Message", "Are you sure you want to delete?","Yes", "Cancel", 0, 1 ); 214 int answer = QMessageBox::warning(this, tr("Message"), tr("Are you sure you want to delete?"),
215 tr("Yes"), tr("Cancel"), 0, 1 );
212 if (answer) 216 if (answer)
213 return; 217 return;
214 218
215 bool removeSuccessfull = true; 219 bool removeSuccessfull = true;
216 QString location = itemList[item]; 220 QString location = itemList[item];
217 // Remove file (.directory in a Directory case) 221 // Remove file (.directory in a Directory case)
218 if(!QFile::remove(location)) 222 if(!QFile::remove(location))
219 removeSuccessfull = false; 223 removeSuccessfull = false;
220 224
221 // Remove directory 225 // Remove directory
222 if(item->parent() == NULL){ 226 if(item->parent() == NULL){
223 // Remove .directory file string 227 // Remove .directory file string
224 location = location.mid(0,location.length()-10); 228 location = location.mid(0,location.length()-10);
225 QDir dir; 229 QDir dir;
226 if(!dir.rmdir(location)) 230 if(!dir.rmdir(location))
227 removeSuccessfull = false; 231 removeSuccessfull = false;
228 } 232 }
229 233
230 // If removing failed. 234 // If removing failed.
231 if(!removeSuccessfull){ 235 if(!removeSuccessfull){
232 qDebug((QString("removeItem: ") + location).latin1()); 236 qDebug((QString("removeItem: ") + location).latin1());
233 QMessageBox::critical(this, "Message", "Can't remove.",QString("Ok") ); 237 QMessageBox::critical(this, tr("Message"), tr("Can't remove."),
238 tr("Ok") );
234 return; 239 return;
235 } 240 }
236 241
237 // Remove from the installer so it wont fail. 242 // Remove from the installer so it wont fail.
238 // Don't need to do this sense the current install uses rm -f so no error 243 // Don't need to do this sense the current install uses rm -f so no error
239 244
240 // Remove from the gui list. 245 // Remove from the gui list.
241 itemList.remove(item); 246 itemList.remove(item);
242 if(item->parent()) 247 if(item->parent())
243 item->parent()->takeItem(item); 248 item->parent()->takeItem(item);
244 delete item; 249 delete item;
245 250
@@ -261,55 +266,56 @@ void TabManager::editCurrentItem(){
261 * @param item the item to edit. 266 * @param item the item to edit.
262 */ 267 */
263void TabManager::editItem( QListViewItem * item){ 268void TabManager::editItem( QListViewItem * item){
264 if(!item) 269 if(!item)
265 return; 270 return;
266 271
267 TabAppLnk app(itemList[item]); 272 TabAppLnk app(itemList[item]);
268 if(!app.isValid()){ 273 if(!app.isValid()){
269 qDebug(QString("editItem: Not a valid applnk file: ") + itemList[item].latin1()); 274 qDebug(QString("editItem: Not a valid applnk file: ") + itemList[item].latin1());
270 return; 275 return;
271 } 276 }
272 277
273 AppEdit application(this, "Application edit", true); 278 AppEdit application(this, tr("Application edit"), true);
274 application.nameLineEdit->setText(app.name()); 279 application.nameLineEdit->setText(app.name());
275 application.iconLineEdit->setText(app.pixmapString()); 280 application.iconLineEdit->setText(app.pixmapString());
276 application.execLineEdit->setText(app.exec()); 281 application.execLineEdit->setText(app.exec());
277 application.commentLineEdit->setText(app.comment()); 282 application.commentLineEdit->setText(app.comment());
278 283
279 if(item->parent() == NULL){ 284 if(item->parent() == NULL){
280 application.execLineEdit->setEnabled(false); 285 application.execLineEdit->setEnabled(false);
281 application.TextLabel3->setEnabled(false); 286 application.TextLabel3->setEnabled(false);
282 application.setCaption("Tab"); 287 application.setCaption(tr("Tab"));
283 } 288 }
284 289
285 // Only do somthing if they hit OK 290 // Only do somthing if they hit OK
286 if(application.exec() == 0) 291 if(application.exec() == 0)
287 return; 292 return;
288 293
289 // If nothing has changed exit (hmmm why did they hit ok?) 294 // If nothing has changed exit (hmmm why did they hit ok?)
290 if(app.name() == application.nameLineEdit->text() && 295 if(app.name() == application.nameLineEdit->text() &&
291 app.pixmapString() == application.iconLineEdit->text() && 296 app.pixmapString() == application.iconLineEdit->text() &&
292 app.comment() == application.commentLineEdit->text() && 297 app.comment() == application.commentLineEdit->text() &&
293 app.exec() == application.execLineEdit->text()) 298 app.exec() == application.execLineEdit->text())
294 return; 299 return;
295 300
296 // Change the applnk file 301 // Change the applnk file
297 QString oldName = app.name(); 302 QString oldName = app.name();
298 app.setName(application.nameLineEdit->text()); 303 app.setName(application.nameLineEdit->text());
299 app.setIcon(application.iconLineEdit->text()); 304 app.setIcon(application.iconLineEdit->text());
300 app.setComment(application.commentLineEdit->text()); 305 app.setComment(application.commentLineEdit->text());
301 app.setExec(application.execLineEdit->text()); 306 app.setExec(application.execLineEdit->text());
302 if(!app.writeLink()){ 307 if(!app.writeLink()){
303 QMessageBox::critical(this, "Message", "Can't save.",QString("Ok") ); 308 QMessageBox::critical(this, tr("Message"), tr("Can't save."),
309 tr("Ok") );
304 return; 310 return;
305 } 311 }
306 312
307 // Update the gui icon and name 313 // Update the gui icon and name
308 item->setText(0,app.name()); 314 item->setText(0,app.name());
309 item->setPixmap(0,app.pixmap()); 315 item->setPixmap(0,app.pixmap());
310 316
311 // We have changed something. 317 // We have changed something.
312 changed = true; 318 changed = true;
313 319
314 // If we were dealing with a new folder or new application change 320 // If we were dealing with a new folder or new application change
315 // the file names. Also change the item location in itemList 321 // the file names. Also change the item location in itemList
@@ -355,25 +361,26 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){
355 newFolder = newFolder.mid(0,newFolder.length()-11); 361 newFolder = newFolder.mid(0,newFolder.length()-11);
356 int slash = newFolder.findRev('/', -1); 362 int slash = newFolder.findRev('/', -1);
357 QString folderName = newFolder.mid(slash+1, newFolder.length()); 363 QString folderName = newFolder.mid(slash+1, newFolder.length());
358 364
359 QString desktopFile = itemList[item]; 365 QString desktopFile = itemList[item];
360 slash = desktopFile.findRev('/', -1); 366 slash = desktopFile.findRev('/', -1);
361 desktopFile = desktopFile.mid(slash, desktopFile.length()); 367 desktopFile = desktopFile.mid(slash, desktopFile.length());
362 newFolder = newFolder + desktopFile; 368 newFolder = newFolder + desktopFile;
363 369
364 // Move file 370 // Move file
365 QDir r; 371 QDir r;
366 if(!r.rename(itemList[item], newFolder)){ 372 if(!r.rename(itemList[item], newFolder)){
367 QMessageBox::critical(this, "Message", "Can't move application.",QString("Ok") ); 373 QMessageBox::critical(this, tr("Message"), tr("Can't move application."),
374 tr("Ok") );
368 return; 375 return;
369 } 376 }
370 //qDebug((QString("moveApplication: ") + itemList[item]).latin1()); 377 //qDebug((QString("moveApplication: ") + itemList[item]).latin1());
371 //qDebug((QString("moveApplication: ") + newFolder).latin1()); 378 //qDebug((QString("moveApplication: ") + newFolder).latin1());
372 379
373 // Move in the gui 380 // Move in the gui
374 item->parent()->takeItem(item); 381 item->parent()->takeItem(item);
375 newGroup->insertItem(item); 382 newGroup->insertItem(item);
376 newGroup->setOpen(true); 383 newGroup->setOpen(true);
377 384
378 // Move file in the installer 385 // Move file in the installer
379 QString installedAppFile; 386 QString installedAppFile;