-rw-r--r-- | microkde/kapplication.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/microkde/kapplication.cpp b/microkde/kapplication.cpp index 2c9e3b6..f36c5ae 100644 --- a/microkde/kapplication.cpp +++ b/microkde/kapplication.cpp @@ -146,65 +146,68 @@ class KBackupPrefs : public QDialog lay->setSpacing( 3 ); lay->setMargin( 3 ); QLabel * lab = new QLabel( message, this ); lay->addWidget( lab ); QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Choose action"), this ); lay->addWidget( format ); format->setExclusive ( true ) ; vcal = new QRadioButton(i18n("Try again now"), format ); tcal = new QRadioButton(i18n("Try again later"), format ); ical = new QRadioButton(i18n("Try again tomorrow"), format ); ocal = new QRadioButton(i18n("Disable backup"), format ); vcal->setChecked( true ); QPushButton * ok = new QPushButton( i18n("OK"), this ); lay->addWidget(ok ); connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); } bool again() { return vcal->isChecked(); } bool later() { return tcal->isChecked(); } bool againTomorrow() { return ical->isChecked(); } private: QRadioButton* vcal, *ical, *ocal, *tcal; }; int KApplication::createBackup( QString fn, QString dp, int numBup ) { if ( numBup < 1) return 3; int ret = 3; //qDebug("KApplication::createBackup %s --- %s --- %d", fn.latin1(), dp.latin1(), numBup); QDir bupDir ( dp ); bool tryAgain = true; while ( tryAgain ) { if ( !bupDir.exists() ) { - KBackupPrefs noDir( i18n("<b>Backup directory does not exist: </b>") + dp.right(30)); + QString bd = dp.right(25); + if ( dp.length() > 25 ) + bd = "..." + bd; + KBackupPrefs noDir( i18n("<b>Backup directory does not exist: </b>") + bd); if ( !noDir.exec() ) return 3; if ( noDir.againTomorrow() ) { return 0; } else if ( noDir.later() ) { return 3; } else if ( !noDir.again() ) { return 2; } } else { tryAgain = false; } } // we have a valid dir! QStringList allFileList = bupDir.entryList(QDir::Files); QFileInfo fileInfo ( fn ); QString fName = fileInfo.fileName (); QStringList fileList; int i; for ( i = 0; i < allFileList.count(); ++i ) { QString fi = allFileList[i]; if ( fi. find( fName ) > -1 ) fileList.append( fi ); } qDebug("KApp: %d backup files exist ", fileList.count()); int count = fileList.count(); fileList.sort(); int remCount = 0; while ( count >= numBup ) { QString fnr = dp + "/"+fileList[remCount]; QFile::remove( fnr ); --count; |