[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [alkimia/work/397112-alkonlinequotes] src: Add GHNS upload support
From:       Ralf Habacker <null () kde ! org>
Date:       2018-08-28 17:00:30
Message-ID: E1fuhLy-0004r1-3l () code ! kde ! org
[Download RAW message or body]

Git commit dab0cbdf995ef41ae1d0b4c265200e7eeedcb901 by Ralf Habacker.
Committed on 28/08/2018 at 01:10.
Pushed by habacker into branch 'work/397112-alkonlinequotes'.

Add GHNS upload support

Update does not finish, neither with KDE4 nor with KF5.

M  +14   -0    src/alkonlinequoteswidget.cpp
M  +1    -0    src/alkonlinequoteswidget.h
M  +7    -0    src/alkonlinequoteswidget.ui

https://commits.kde.org/alkimia/dab0cbdf995ef41ae1d0b4c265200e7eeedcb901

diff --git a/src/alkonlinequoteswidget.cpp b/src/alkonlinequoteswidget.cpp
index f8b089b..797705e 100644
--- a/src/alkonlinequoteswidget.cpp
+++ b/src/alkonlinequoteswidget.cpp
@@ -104,6 +104,7 @@ AlkOnlineQuotesWidget::AlkOnlineQuotesWidget(QWidget *parent)
     connect(m_checkButton, SIGNAL(clicked()), this, SLOT(slotCheckEntry()));
     connect(m_deleteButton, SIGNAL(clicked()), this, SLOT(slotDeleteEntry()));
     connect(m_installButton, SIGNAL(clicked()), this, SLOT(slotInstallEntries()));
+    connect(m_uploadButton, SIGNAL(clicked()), this, SLOT(slotUploadEntry()));
 
     connect(m_quoteSourceList, SIGNAL(itemSelectionChanged()), this, SLOT(slotLoadWidgets()));
     connect(m_quoteSourceList, SIGNAL(itemChanged(QListWidgetItem *)), this,
@@ -474,6 +475,19 @@ void AlkOnlineQuotesWidget::slotInstallEntries()
     loadQuotesList();
 }
 
+void AlkOnlineQuotesWidget::slotUploadEntry()
+{
+    QString configFile = d->m_profile->hotNewStuffConfigFile();
+
+    QUrl url = QUrl::fromLocalFile(d->m_profile->hotNewStuffWriteFilePath(d->m_currentItem.name()));
+    qDebug() << "uploading file" << url;
+    QPointer<KNS3::UploadDialog> dialog = new KNS3::UploadDialog(configFile, this);
+    dialog->setUploadName(d->m_currentItem.name());
+    dialog->setUploadFile(url);
+    dialog->exec();
+    delete dialog;
+}
+
 QString AlkOnlineQuotesWidget::expandedUrl() const
 {
     if (d->m_currentItem.url().contains("%2")) {
diff --git a/src/alkonlinequoteswidget.h b/src/alkonlinequoteswidget.h
index 1f3d0d0..65d6806 100644
--- a/src/alkonlinequoteswidget.h
+++ b/src/alkonlinequoteswidget.h
@@ -79,6 +79,7 @@ protected slots:
     void slotEntryRenamed(QListWidgetItem *item);
     void slotStartRename(QListWidgetItem *item);
     void slotInstallEntries();
+    void slotUploadEntry();
 
 protected:
     void loadProfiles();
diff --git a/src/alkonlinequoteswidget.ui b/src/alkonlinequoteswidget.ui
index dcab4cd..3b95266 100644
--- a/src/alkonlinequoteswidget.ui
+++ b/src/alkonlinequoteswidget.ui
@@ -141,6 +141,13 @@
               </property>
              </widget>
             </item>
+            <item>
+             <widget class="QPushButton" name="m_uploadButton">
+              <property name="text">
+               <string>Upload</string>
+              </property>
+             </widget>
+            </item>
             <item>
              <spacer name="verticalSpacer">
               <property name="orientation">

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic