Hey all,
This is my first patch, it just adds "posting private picture to
imagebin.ca from the pastebin plasmoid" as the title says, it needs to
be applied from kdeplasma-addons, hope it works for you.
Cheers,
Pat
Index: applets/pastebin/pastebin.cpp
===================================================================
--- applets/pastebin/pastebin.cpp (revision 1008583)
+++ applets/pastebin/pastebin.cpp (working copy)
@@ -463,6 +463,15 @@ void Pastebin::createConfigurationInterf
QString imageshackURL = cg.readEntry("imageshack", "http://imageshack.us");
uiServers.imageshack->setText(imageshackURL);
+
+ uiConfig.textServer->setCurrentIndex(m_textBackend);
+
+ QWidget *serversoptions = new QWidget();
+ uiServersOptions.setupUi(serversoptions);
+ int imagebinPrivacy = cg.readEntry("imagebinPrivacy", "0").toInt();
+ uiServersOptions.imagebinPrivacy->setCurrentIndex(imagebinPrivacy);
+
+ parent->addPage(serversoptions, i18n("Servers Options"), Applet::icon());
}
void Pastebin::configAccepted()
@@ -477,6 +486,8 @@ void Pastebin::configAccepted()
QString imagebincaURL = uiServers.imagebinca->text();
QString imageshackURL = uiServers.imageshack->text();
+ int imagebinPrivacy = uiServersOptions.imagebinPrivacy->currentIndex();
+
cg.writeEntry("TextBackend", textBackend);
cg.writeEntry("ImageBackend", imageBackend);
cg.writeEntry("HistorySize", historySize);
@@ -486,6 +497,8 @@ void Pastebin::configAccepted()
cg.writeEntry("imagebinca", imagebincaURL);
cg.writeEntry("imageshack", imageshackURL);
+ cg.writeEntry("imagebinPrivacy", imagebinPrivacy);
+
setTextServer(textBackend);
setImageServer(imageBackend);
setHistorySize(historySize);
Index: applets/pastebin/backends/imagebinca.cpp
===================================================================
--- applets/pastebin/backends/imagebinca.cpp (revision 1008583)
+++ applets/pastebin/backends/imagebinca.cpp (working copy)
@@ -35,8 +35,8 @@
ImagebinCAServer::ImagebinCAServer(const KConfigGroup& config)
: PastebinServer()
{
+ m_privacy = config.readEntry("imagebinPrivacy", "0");
m_server = config.readEntry("imagebinca", "http://imagebin.ca");
-
m_boundary = "----------";
m_boundary += KRandom::randomString(42 + 13).toAscii();
}
@@ -168,10 +168,17 @@ void ImagebinCAServer::post(const QStrin
addPair("tags", "plasma");
url.addQueryItem("tags", "plasma");
- addPair("adult", "f");
- url.addQueryItem("adult", "f");
+ if(m_privacy == "0"){
+ adult = "f";
+ } else {
+ adult = "t";
+ }
+
+ addPair("adult", adult);
+ url.addQueryItem("adult", adult);
addFile("f", content);
+
finish();
_data.clear();
Index: applets/pastebin/backends/imagebinca.h
===================================================================
--- applets/pastebin/backends/imagebinca.h (revision 1008583)
+++ applets/pastebin/backends/imagebinca.h (working copy)
@@ -42,6 +42,8 @@ public:
void finish();
bool addPair(const QString& name, const QString& value);
bool addFile(const QString& name,const QString& path);
+ QString adult;
+ QString m_privacy;
protected:
QByteArray m_buffer;
Index: applets/pastebin/pastebin.h
===================================================================
--- applets/pastebin/pastebin.h (revision 1008583)
+++ applets/pastebin/pastebin.h (working copy)
@@ -23,6 +23,7 @@
#include "backends/backends.h"
#include "ui_pastebinConfig.h"
#include "ui_pastebinServersConfig.h"
+#include "ui_pastebinServersOptionsConfig.h"
#include <KDE/KIO/TransferJob>
#include <KDE/KIO/Job>
@@ -153,6 +154,7 @@ private:
Ui::pastebinConfig uiConfig;
Ui::pastebinServersConfig uiServers;
+ Ui::pastebinServersOptionsConfig uiServersOptions;
};
K_EXPORT_PLASMA_APPLET(pastebin, Pastebin)
Index: applets/pastebin/CMakeLists.txt
===================================================================
--- applets/pastebin/CMakeLists.txt (revision 1008583)
+++ applets/pastebin/CMakeLists.txt (working copy)
@@ -1,5 +1,8 @@
project(plasma-pastebin)
+cmake_minimum_required(VERSION 2.6)
+find_package(KDE4 REQUIRED)
+
set(pastebin_SRCS
backends/server.cpp
backends/pastebinca.cpp
@@ -10,6 +13,7 @@ set(pastebin_SRCS
kde4_add_ui_files(pastebin_SRCS pastebinConfig.ui)
kde4_add_ui_files(pastebin_SRCS pastebinServersConfig.ui)
+kde4_add_ui_files(pastebin_SRCS pastebinServersOptionsConfig.ui)
kde4_add_plugin(plasma_applet_pastebin ${pastebin_SRCS})
target_link_libraries(plasma_applet_pastebin ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS})
Index: applets/pastebin/pastebinServersOptionsConfig.ui
===================================================================
--- applets/pastebin/pastebinServersOptionsConfig.ui (revision 0)
+++ applets/pastebin/pastebinServersOptionsConfig.ui (revision 0)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>pastebinServersOptionsConfig</class>
+ <widget class="QWidget" name="pastebinServersOptionsConfig">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>245</width>
+ <height>96</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Pastebin Servers Options Config Dialog</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="1" column="0">
+ <widget class="QLabel" name="imagebinPrivacyLabel">
+ <property name="text">
+ <string>Make Imagebin images:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="KComboBox" name="imagebinPrivacy">
+ <item>
+ <property name="text">
+ <string>Public</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Private</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>KComboBox</class>
+ <extends>QComboBox</extends>
+ <header>kcombobox.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
_______________________________________________
Plasma-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/plasma-devel