Verified Commit 7716481f authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Remove defunct KNS upload functionality

The upload did not work for years and the component will be deprecated.
Also there exists other share functionality in the button next to it.
parent efe5c81a
Pipeline #68350 passed with stage
in 16 minutes and 54 seconds
......@@ -22,7 +22,6 @@
#include <KLocalizedString>
#include <KStandardAction>
#include <QTemporaryDir>
#include <kns3/uploaddialog.h>
#include <kzip.h>
#include <PimCommon/PurposeMenuWidget>
......@@ -71,14 +70,6 @@ SieveEditorWidget::SieveEditorWidget(bool useMenuBar, QWidget *parent)
toolbar->addAction(mGenerateXml);
}
QStringList overlays;
overlays << QStringLiteral("list-add");
mShareScript = new QAction(QIcon(new KIconEngine(QStringLiteral("get-hot-new-stuff"), KIconLoader::global(), overlays)), i18n("Share Script..."), this);
connect(mShareScript, &QAction::triggered, this, &SieveEditorWidget::slotShareScript);
// Add action to toolBar
toolbar->addAction(mShareScript);
auto purposeMenu = new SievePurposeMenuWidget(this, this);
auto shareAction = new KActionMenu(i18n("Share..."), this);
shareAction->setPopupMode(QToolButton::InstantPopup);
......@@ -120,7 +111,6 @@ SieveEditorWidget::SieveEditorWidget(bool useMenuBar, QWidget *parent)
menuBar->fileMenu()->addSeparator();
menuBar->fileMenu()->addAction(mSaveAs);
menuBar->fileMenu()->addSeparator();
menuBar->fileMenu()->addAction(mShareScript);
menuBar->toolsMenu()->addSeparator();
menuBar->fileMenu()->addAction(shareAction);
menuBar->toolsMenu()->addSeparator();
......@@ -378,40 +368,6 @@ void SieveEditorWidget::setModified(bool b)
}
}
void SieveEditorWidget::slotShareScript()
{
QTemporaryDir tmp;
QTemporaryFile tmpFile;
if (tmpFile.open()) {
QTextStream out(&tmpFile);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8");
#endif
out << script();
tmpFile.close();
const QString sourceName = mScriptName->text();
const QString zipFileName = tmp.path() + QLatin1Char('/') + sourceName + QLatin1String(".zip");
KZip *zip = new KZip(zipFileName);
if (zip->open(QIODevice::WriteOnly)) {
if (zip->addLocalFile(tmpFile.fileName(), sourceName + QLatin1String(".siv"))) {
zip->close();
const QString knsrcPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("knsrcfiles/ksieve_script.knsrc"));
QPointer<KNS3::UploadDialog> dialog = new KNS3::UploadDialog(knsrcPath, this);
dialog->setUploadFile(QUrl::fromLocalFile(zipFileName));
dialog->setUploadName(sourceName);
dialog->setDescription(i18nc("Default description for the source", "My Sieve Script"));
dialog->exec();
delete dialog;
} else {
zip->close();
}
}
delete zip;
} else {
qCWarning(LIBKSIEVE_LOG) << "Impossible to open temp file";
}
}
void SieveEditorWidget::changeMode(EditorMode mode)
{
if (mode != mMode) {
......
......@@ -88,7 +88,6 @@ public Q_SLOTS:
void goToLine();
void slotSaveAs();
void slotImport();
void slotShareScript();
void slotCreateRulesGraphically();
void slotCheckSyntax();
void comment();
......@@ -126,7 +125,6 @@ private:
QAction *mSwitchMode = nullptr;
QAction *mCreateRulesGraphically = nullptr;
QAction *mSaveAs = nullptr;
QAction *mShareScript = nullptr;
QAction *mGenerateXml = nullptr;
QAction *mServerInfo = nullptr;
EditorMode mMode = EditorMode::TextMode;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment