~ubuntu-branches/ubuntu/quantal/ark/quantal

« back to all changes in this revision

Viewing changes to kerfuffle/extractiondialog.cpp

  • Committer: Package Import Robot
  • Author(s): Felix Geyer
  • Date: 2012-06-06 18:50:49 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20120606185049-z43lsy5wwp3wtrgt
Tags: 4:4.8.80-0ubuntu1
* Merge with Debian git repository, remaining changes:
  - Suggest instead of recommend p7zip-full
  - Add and install utilities-file-archiver.xpm
* New upstream beta release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
103
103
 
104
104
        const QString pathWithSubfolder = url().pathOrUrl(KUrl::AddTrailingSlash) + subfolder();
105
105
 
106
 
        if (KIO::NetAccess::exists(pathWithSubfolder, KIO::NetAccess::SourceSide, 0)) {
107
 
            if (QFileInfo(pathWithSubfolder).isDir()) {
108
 
                int overwrite = KMessageBox::questionYesNo(0, i18nc("@info", "The folder <filename>%1</filename> already exists. Are you sure you want to extract here?", pathWithSubfolder), i18n("Folder exists"), KGuiItem(i18n("Extract here")), KGuiItem(i18n("Cancel")));
 
106
        while (1) {
 
107
            if (KIO::NetAccess::exists(pathWithSubfolder, KIO::NetAccess::SourceSide, 0)) {
 
108
                if (QFileInfo(pathWithSubfolder).isDir()) {
 
109
                    int overwrite = KMessageBox::questionYesNoCancel(0, i18nc("@info", "The folder <filename>%1</filename> already exists. Are you sure you want to extract here?", pathWithSubfolder), i18n("Folder exists"), KGuiItem(i18n("Extract here")), KGuiItem(i18n("Retry")), KGuiItem(i18n("Cancel")));
109
110
 
110
 
                if (overwrite == KMessageBox::No) {
111
 
                    //TODO: choosing retry should also be possible, so one does
112
 
                    //not have to do the procedure one more time.
 
111
                    if (overwrite == KMessageBox::No) {
 
112
                        // The user clicked Retry.
 
113
                        continue;
 
114
                    } else if (overwrite == KMessageBox::Cancel) {
 
115
                        return;
 
116
                    }
 
117
                } else {
 
118
                    KMessageBox::detailedError(0,
 
119
                                               i18nc("@info", "The folder <filename>%1</filename> could not be created.", subfolder()),
 
120
                                               i18nc("@info", "<filename>%1</filename> already exists, but is not a folder.", subfolder()));
113
121
                    return;
114
122
                }
115
 
            } else {
 
123
            } else if (!KIO::NetAccess::mkdir(pathWithSubfolder, 0)) {
116
124
                KMessageBox::detailedError(0,
117
125
                                           i18nc("@info", "The folder <filename>%1</filename> could not be created.", subfolder()),
118
 
                                           i18nc("@info", "<filename>%1</filename> already exists, but is not a folder.", subfolder()));
 
126
                                           i18n("Please check your permissions to create it."));
119
127
                return;
120
128
            }
121
 
        } else if (!KIO::NetAccess::mkdir(pathWithSubfolder, 0)) {
122
 
            KMessageBox::detailedError(0,
123
 
                                       i18nc("@info", "The folder <filename>%1</filename> could not be created.", subfolder()),
124
 
                                       i18n("Please check your permissions to create it."));
125
 
            return;
 
129
            break;
126
130
        }
127
131
    }
128
132