Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/plugins/csvexport/csvexporterplugin.cpp
Context not available. | |||||
29 | 29 | | |||
---|---|---|---|---|---|
30 | #include <KActionCollection> | 30 | #include <KActionCollection> | ||
31 | #include <KLocalizedString> | 31 | #include <KLocalizedString> | ||
32 | #include <KMessageBox> | ||||
33 | #include <KIO/StatJob> | ||||
32 | 34 | | |||
33 | // ---------------------------------------------------------------------------- | 35 | // ---------------------------------------------------------------------------- | ||
34 | // Project Includes | 36 | // Project Includes | ||
Context not available. | |||||
74 | 76 | | |||
75 | bool CsvExporterPlugin::okToWriteFile(const QUrl &url) | 77 | bool CsvExporterPlugin::okToWriteFile(const QUrl &url) | ||
76 | { | 78 | { | ||
77 | Q_UNUSED(url) | | |||
78 | | ||||
79 | // check if the file exists and warn the user | 79 | // check if the file exists and warn the user | ||
80 | bool reallySaveFile = true; | 80 | bool reallySaveFile = true; | ||
81 | 81 | | |||
82 | // TODO: port this to KF5 (NetAccess) | 82 | bool fileExists = false; | ||
83 | #if 0 | 83 | | ||
84 | if (KIO::NetAccess::exists(url, KIO::NetAccess::SourceSide, 0)) { | 84 | if (url.isValid()) { | ||
85 | short int detailLevel = 0; // Lowest level: file/dir/symlink/none | ||||
86 | KIO::StatJob* statjob = KIO::stat(url, KIO::StatJob::SourceSide, detailLevel); | ||||
87 | bool noerror = statjob->exec(); | ||||
88 | if (noerror) { | ||||
89 | // We want a file | ||||
90 | fileExists = !statjob->statResult().isDir(); | ||||
91 | } | ||||
92 | } | ||||
93 | | ||||
94 | if (fileExists) { | ||||
85 | if (KMessageBox::warningYesNo(0, QString("<qt>") + i18n("The file <b>%1</b> already exists. Do you really want to overwrite it?", url.toDisplayString(QUrl::PreferLocalFile)) + QString("</qt>"), i18n("File already exists")) != KMessageBox::Yes) | 95 | if (KMessageBox::warningYesNo(0, QString("<qt>") + i18n("The file <b>%1</b> already exists. Do you really want to overwrite it?", url.toDisplayString(QUrl::PreferLocalFile)) + QString("</qt>"), i18n("File already exists")) != KMessageBox::Yes) | ||
86 | reallySaveFile = false; | 96 | reallySaveFile = false; | ||
87 | } | 97 | } | ||
88 | #endif | | |||
89 | return reallySaveFile; | 98 | return reallySaveFile; | ||
90 | } | 99 | } | ||
Context not available. |