mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-10 05:35:20 -05:00
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
This commit is contained in:
parent
e8df7c4904
commit
8ea9b94cd9
1 changed files with 12 additions and 7 deletions
|
|
@ -40,8 +40,10 @@ Install::Install(RbSettings *sett,QWidget *parent) : QDialog(parent)
|
||||||
if(version != "")
|
if(version != "")
|
||||||
{
|
{
|
||||||
ui.Backupgroup->show();
|
ui.Backupgroup->show();
|
||||||
m_backupName = settings->mountpoint() + "/.backup/rockbox-backup-"+version+".zip";
|
m_backupName = settings->mountpoint();
|
||||||
ui.backupLocation->setText(fontMetrics().elidedText(m_backupName,Qt::ElideMiddle,200));
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -123,10 +125,9 @@ void Install::accept()
|
||||||
if(ui.backup->isChecked())
|
if(ui.backup->isChecked())
|
||||||
{
|
{
|
||||||
logger->addItem(tr("Beginning Backup..."),LOGINFO);
|
logger->addItem(tr("Beginning Backup..."),LOGINFO);
|
||||||
QString backupName = ui.backupLocation->text();
|
|
||||||
|
|
||||||
//! create dir, if it doesnt exist
|
//! create dir, if it doesnt exist
|
||||||
QFileInfo backupFile(backupName);
|
QFileInfo backupFile(m_backupName);
|
||||||
if(!QDir(backupFile.path()).exists())
|
if(!QDir(backupFile.path()).exists())
|
||||||
{
|
{
|
||||||
QDir a;
|
QDir a;
|
||||||
|
|
@ -136,7 +137,7 @@ void Install::accept()
|
||||||
//! create backup
|
//! create backup
|
||||||
RbZip backup;
|
RbZip backup;
|
||||||
connect(&backup,SIGNAL(zipProgress(int,int)),this,SLOT(updateDataReadProgress(int,int)));
|
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);
|
logger->addItem(tr("Backup successfull"),LOGOK);
|
||||||
}
|
}
|
||||||
|
|
@ -169,8 +170,12 @@ void Install::accept()
|
||||||
|
|
||||||
void Install::changeBackupPath()
|
void Install::changeBackupPath()
|
||||||
{
|
{
|
||||||
m_backupName = QFileDialog::getSaveFileName(this,"Select Backup Filename",ui.backupLocation->text());
|
QString backupString = QFileDialog::getSaveFileName(this,"Select Backup Filename",m_backupName, "*.zip");
|
||||||
ui.backupLocation->setText(QWidget::fontMetrics().elidedText(m_backupName,Qt::ElideMiddle,200));
|
// 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)
|
void Install::updateDataReadProgress(int read, int total)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue