Re: [PATCH] Adds posting private picture to imagebin.ca from the pastebin plasmoid

2009-08-09 Thread Patrick Aljord
oops, forgot to hit the publish button, should be up now
http://reviewboard.kde.org/r/1248/

On Sun, Aug 9, 2009 at 3:00 PM, Patrick Aljord wrote:
> http://reviewboard.kde.org/r/1248/ here is the diff with the
> imagebinPrivacy always as int.
>
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: [PATCH] Adds posting private picture to imagebin.ca from the pastebin plasmoid

2009-08-09 Thread Patrick Aljord
http://reviewboard.kde.org/r/1248/ here is the diff with the
imagebinPrivacy always as int.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: [PATCH] Adds posting private picture to imagebin.ca from the pastebin plasmoid

2009-08-09 Thread Chani
On August 9, 2009 12:42:30 Patrick Aljord wrote:
> On Sat, Aug 8, 2009 at 1:56 PM, Chani  wrote:
> > kompare won't load the diff for some reason...
>
> I used the techbase tutorial here
> http://techbase.kde.org/Contribute/Send_Patches#Creating_a_Simple_File_Patc
>h and used that command:
>
> svn diff --diff-cmd diff --extensions "-u -p"

huh. I just use svn diff. :)

it's possible the problem was with trying to load a file from kmail, and not 
with the diff itself.

-- 
This message brought to you by eevil bananas and the number 3.
www.chani3.com


signature.asc
Description: This is a digitally signed message part.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: [PATCH] Adds posting private picture to imagebin.ca from the pastebin plasmoid

2009-08-09 Thread Patrick Aljord
On Sat, Aug 8, 2009 at 1:56 PM, Chani  wrote:
>
> kompare won't load the diff for some reason...

I used the techbase tutorial here
http://techbase.kde.org/Contribute/Send_Patches#Creating_a_Simple_File_Patch
and used that command:

svn diff --diff-cmd diff --extensions "-u -p"
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: [PATCH] Adds posting private picture to imagebin.ca from the pastebin plasmoid

2009-08-08 Thread Patrick Aljord
I was thinking with time we could add more options for alll the
different servers, then a new page would make sense, for now it's true
that it looks empty.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: [PATCH] Adds posting private picture to imagebin.ca from the pastebin plasmoid

2009-08-08 Thread Chani
On August 8, 2009 18:41:32 Patrick Aljord wrote:
> Thanks to all for your comments. I haven't coded anything in C++ for
> at least 3 years so I guess it shows :)
>
> I'll send the patch with your suggestions tomorrow, in the meantime
> here is the screenshot http://imagebin.ca/view/fyaoR7T.html

hmmm.
I don't think we need a separate page for that option. there's not much on the 
first page, after all.

actually I'm not too keen on the existing "servers" page either. a very odd 
way to allow people to use other servers... I wonder why it was done that 
way...

-- 
This message brought to you by eevil bananas and the number 3.
www.chani3.com


signature.asc
Description: This is a digitally signed message part.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: [PATCH] Adds posting private picture to imagebin.ca from the pastebin plasmoid

2009-08-08 Thread Patrick Aljord
Thanks to all for your comments. I haven't coded anything in C++ for
at least 3 years so I guess it shows :)

I'll send the patch with your suggestions tomorrow, in the meantime
here is the screenshot http://imagebin.ca/view/fyaoR7T.html
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: [PATCH] Adds posting private picture to imagebin.ca from the pastebin plasmoid

2009-08-08 Thread Artur Souza (MoRpHeUz)
On Saturday 08 August 2009, 16:35 Chani wrote:
> oh.
> but we also have this:
> int imagebinPrivacy = uiServersOptions.imagebinPrivacy->currentIndex();
> 
> so, either make it always an int, or make it an enum. don't use a string.
> especially a string that just contains a number anyways...

+1 for always int

--
Artur Duque de Souza
openBossa Research Labs
INdT - Instituto Nokia de Tecnologia
--
Blog: http://blog.morpheuz.cc
PGP: 0xDBEEAAC3 @ wwwkeys.pgp.net
--


signature.asc
Description: This is a digitally signed message part.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: [PATCH] Adds posting private picture to imagebin.ca from the pastebin plasmoid

2009-08-08 Thread Chani

> > one thing I don't get is how you managed to use a string ("0") as the
> > default value for an int ;)
>
> +QString m_privacy;
>
> m_privacy seems to be a QString :)

oh.
but we also have this:
int imagebinPrivacy = uiServersOptions.imagebinPrivacy->currentIndex();

so, either make it always an int, or make it an enum. don't use a string. 
especially a string that just contains a number anyways...

-- 
This message brought to you by eevil bananas and the number 3.
www.chani3.com


signature.asc
Description: This is a digitally signed message part.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: [PATCH] Adds posting private picture to imagebin.ca from the pastebin plasmoid

2009-08-08 Thread Artur Souza (MoRpHeUz)
On Saturday 08 August 2009, 13:40 Patrick Aljord wrote:
> 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.

Thanks for the patch! As Chani asked, can you provide a screenshot of the 
config 
dialog ?

Some comments on code:

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;


It seems that you do not need to store this string in the object and can 
declare it when you setup this string, something like this:

QString adult;
+if(m_privacy == "0"){
+  adult = "f";
+} else {
+  adult = "t";
+}

> one thing I don't get is how you managed to use a string ("0") as the default 
> value for an int ;)
+QString m_privacy;

m_privacy seems to be a QString :)

Cheers!

--
Artur Duque de Souza
openBossa Research Labs
INdT - Instituto Nokia de Tecnologia
--
Blog: http://blog.morpheuz.cc
PGP: 0xDBEEAAC3 @ wwwkeys.pgp.net
--


signature.asc
Description: This is a digitally signed message part.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


Re: [PATCH] Adds posting private picture to imagebin.ca from the pastebin plasmoid

2009-08-08 Thread Chani
On August 8, 2009 09:40:28 Patrick Aljord wrote:
> 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

thanks for the patch :)

the code looks generally ok, although kompare won't load the diff for some 
reason...

one thing I don't get is how you managed to use a string ("0") as the default 
value for an int ;)

can you give us a screenshot of the new config?

btw, next time put your patch on reviewboard.kde.org, less chance of us losing 
it there :)

-- 
This message brought to you by eevil bananas and the number 3.
www.chani3.com


signature.asc
Description: This is a digitally signed message part.
___
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


[PATCH] Adds posting private picture to imagebin.ca from the pastebin plasmoid

2009-08-08 Thread Patrick Aljord
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 
 #include 
@@ -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 @@
+
+
+ pastebinServersOptionsConfig
+ 
+  
+   
+0
+0
+245
+9