summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (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 @@
#define NEW_APPLICATION "NewApp"
#define APPLICATION_EXTENSION ".desktop"
#define APPLICATION_EXTENSION_LENGTH 8
/**
* Constructor. Sets up signals. Performs initial scan of applications
* and tabs
*/
TabManager::TabManager( QWidget* parent, const char* name):TabManagerBase(parent, name), changed(false){
rescanFolder(HOME_APP_DIR);
// Connect the signals and slots
- connect(tabList, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(editItem(QListViewItem*)));
+ connect(tabList, SIGNAL(doubleClicked(QListViewItem *)),
+ this, SLOT(editItem(QListViewItem*)));
(tabList->header())->hide();
- connect(tabList, SIGNAL(moveItem(QListViewItem *, QListViewItem *)), this, SLOT(moveApplication(QListViewItem *, QListViewItem *)));
+ connect(tabList, SIGNAL(moveItem(QListViewItem *, QListViewItem *)),
+ this, SLOT(moveApplication(QListViewItem *, QListViewItem *)));
}
/**
* If anything in the tab's have been changed then update the system or alert
* the user.
*/
TabManager::~TabManager(){
if(changed){
- //QMessageBox::critical(this, "Message", "Please restart Qtopia to see all new changes.",QString("Ok") );
+ //QMessageBox::critical(this, tr("Message"), tr("Please restart Qtopia to see all new changes."),tr("Ok") );
//filename = fn;
QCopEnvelope e("QPE/System", "linkChanged(QString)");
//e << description << filename << mimetype;
QString link; //we'll just send an empty string
e << link;
}
}
/**
* Scans root directory for any tabs or applications. Will recursivly go down,
* but will not follow symlinks.
* @param directory - the directory to look in.
@@ -194,52 +196,55 @@ void TabManager::newApplication(){
* Remove the item.
* Check if we can
* Prompt user
* Delete physical file (Dir, remove .dir, then dir. File, remove file)
* Remove from installer if need too.
*/
void TabManager::removeItem(){
// Make sure we can delete
QListViewItem *item = tabList->currentItem();
if(!item)
return;
if(item->childCount() > 0){
- QMessageBox::critical(this, "Message", "Can't remove with applications\nstill in the group.",QString("Ok") );
+ QMessageBox::critical(this, tr("Message"), tr("Can't remove with applications\nstill in the group."),
+ tr("Ok") );
return;
}
// Prompt.
- int answer = QMessageBox::warning(this, "Message", "Are you sure you want to delete?","Yes", "Cancel", 0, 1 );
+ int answer = QMessageBox::warning(this, tr("Message"), tr("Are you sure you want to delete?"),
+ tr("Yes"), tr("Cancel"), 0, 1 );
if (answer)
return;
bool removeSuccessfull = true;
QString location = itemList[item];
// Remove file (.directory in a Directory case)
if(!QFile::remove(location))
removeSuccessfull = false;
// Remove directory
if(item->parent() == NULL){
// Remove .directory file string
location = location.mid(0,location.length()-10);
QDir dir;
if(!dir.rmdir(location))
removeSuccessfull = false;
}
// If removing failed.
if(!removeSuccessfull){
qDebug((QString("removeItem: ") + location).latin1());
- QMessageBox::critical(this, "Message", "Can't remove.",QString("Ok") );
+ QMessageBox::critical(this, tr("Message"), tr("Can't remove."),
+ tr("Ok") );
return;
}
// Remove from the installer so it wont fail.
// Don't need to do this sense the current install uses rm -f so no error
// Remove from the gui list.
itemList.remove(item);
if(item->parent())
item->parent()->takeItem(item);
delete item;
@@ -261,55 +266,56 @@ void TabManager::editCurrentItem(){
* @param item the item to edit.
*/
void TabManager::editItem( QListViewItem * item){
if(!item)
return;
TabAppLnk app(itemList[item]);
if(!app.isValid()){
qDebug(QString("editItem: Not a valid applnk file: ") + itemList[item].latin1());
return;
}
- AppEdit application(this, "Application edit", true);
+ AppEdit application(this, tr("Application edit"), true);
application.nameLineEdit->setText(app.name());
application.iconLineEdit->setText(app.pixmapString());
application.execLineEdit->setText(app.exec());
application.commentLineEdit->setText(app.comment());
if(item->parent() == NULL){
application.execLineEdit->setEnabled(false);
application.TextLabel3->setEnabled(false);
- application.setCaption("Tab");
+ application.setCaption(tr("Tab"));
}
// Only do somthing if they hit OK
if(application.exec() == 0)
return;
// If nothing has changed exit (hmmm why did they hit ok?)
if(app.name() == application.nameLineEdit->text() &&
app.pixmapString() == application.iconLineEdit->text() &&
app.comment() == application.commentLineEdit->text() &&
app.exec() == application.execLineEdit->text())
return;
// Change the applnk file
QString oldName = app.name();
app.setName(application.nameLineEdit->text());
app.setIcon(application.iconLineEdit->text());
app.setComment(application.commentLineEdit->text());
app.setExec(application.execLineEdit->text());
if(!app.writeLink()){
- QMessageBox::critical(this, "Message", "Can't save.",QString("Ok") );
+ QMessageBox::critical(this, tr("Message"), tr("Can't save."),
+ tr("Ok") );
return;
}
// Update the gui icon and name
item->setText(0,app.name());
item->setPixmap(0,app.pixmap());
// We have changed something.
changed = true;
// If we were dealing with a new folder or new application change
// the file names. Also change the item location in itemList
@@ -355,25 +361,26 @@ void TabManager::moveApplication(QListViewItem *item, QListViewItem *newGroup){
newFolder = newFolder.mid(0,newFolder.length()-11);
int slash = newFolder.findRev('/', -1);
QString folderName = newFolder.mid(slash+1, newFolder.length());
QString desktopFile = itemList[item];
slash = desktopFile.findRev('/', -1);
desktopFile = desktopFile.mid(slash, desktopFile.length());
newFolder = newFolder + desktopFile;
// Move file
QDir r;
if(!r.rename(itemList[item], newFolder)){
- QMessageBox::critical(this, "Message", "Can't move application.",QString("Ok") );
+ QMessageBox::critical(this, tr("Message"), tr("Can't move application."),
+ tr("Ok") );
return;
}
//qDebug((QString("moveApplication: ") + itemList[item]).latin1());
//qDebug((QString("moveApplication: ") + newFolder).latin1());
// Move in the gui
item->parent()->takeItem(item);
newGroup->insertItem(item);
newGroup->setOpen(true);
// Move file in the installer
QString installedAppFile;