summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2008-05-12 17:29:03 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2008-05-12 17:29:03 +0000
commit8ea9b94cd95e39f96d3f5cac002ada826a7df5b0 (patch)
tree69a44b85dada6f7339d28896becfc12afbbc76f7
parente8df7c490472d68b4e088ba0b6c3670fda42bfdb (diff)
fix some small glitches for backup:
- use the complete path as starting folder for browsing, not the elided one - don't drop the old path if selection was cancelled - show native dir separators git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17473 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--rbutil/rbutilqt/install.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/rbutil/rbutilqt/install.cpp b/rbutil/rbutilqt/install.cpp
index c6221e8975..a2344c7346 100644
--- a/rbutil/rbutilqt/install.cpp
+++ b/rbutil/rbutilqt/install.cpp
@@ -40,8 +40,10 @@ Install::Install(RbSettings *sett,QWidget *parent) : QDialog(parent)
if(version != "")
{
ui.Backupgroup->show();
- m_backupName = settings->mountpoint() + "/.backup/rockbox-backup-"+version+".zip";
- ui.backupLocation->setText(fontMetrics().elidedText(m_backupName,Qt::ElideMiddle,200));
+ m_backupName = settings->mountpoint();
+ if(!m_backupName.endsWith("/")) m_backupName += "/";
+ m_backupName += ".backup/rockbox-backup-"+version+".zip";
+ ui.backupLocation->setText(QDir::toNativeSeparators(fontMetrics().elidedText(m_backupName,Qt::ElideMiddle,200)));
}
else
{
@@ -123,10 +125,9 @@ void Install::accept()
if(ui.backup->isChecked())
{
logger->addItem(tr("Beginning Backup..."),LOGINFO);
- QString backupName = ui.backupLocation->text();
//! create dir, if it doesnt exist
- QFileInfo backupFile(backupName);
+ QFileInfo backupFile(m_backupName);
if(!QDir(backupFile.path()).exists())
{
QDir a;
@@ -136,7 +137,7 @@ void Install::accept()
//! create backup
RbZip backup;
connect(&backup,SIGNAL(zipProgress(int,int)),this,SLOT(updateDataReadProgress(int,int)));
- if(backup.createZip(backupName,settings->mountpoint() + "/.rockbox") == Zip::Ok)
+ if(backup.createZip(m_backupName,settings->mountpoint() + "/.rockbox") == Zip::Ok)
{
logger->addItem(tr("Backup successfull"),LOGOK);
}
@@ -169,8 +170,12 @@ void Install::accept()
void Install::changeBackupPath()
{
- m_backupName = QFileDialog::getSaveFileName(this,"Select Backup Filename",ui.backupLocation->text());
- ui.backupLocation->setText(QWidget::fontMetrics().elidedText(m_backupName,Qt::ElideMiddle,200));
+ QString backupString = QFileDialog::getSaveFileName(this,"Select Backup Filename",m_backupName, "*.zip");
+ // only update if a filename was entered, ignore if cancelled
+ if(!backupString.isEmpty()) {
+ ui.backupLocation->setText(QDir::toNativeSeparators(backupString));
+ m_backupName = backupString;
+ }
}
void Install::updateDataReadProgress(int read, int total)