<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][14616] </title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=14616">14616</a></dd>
<dt>Author</dt> <dd>jmesquita</dd>
<dt>Date</dt> <dd>2009-08-24 02:03:42 -0500 (Mon, 24 Aug 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add the ability to pastebin logs directly to pastebin.freeswitch.org</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsoleplugincentralWidgetui">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/centralWidget.ui</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsoleplugincpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsolepluginh">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.h</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsolepluginpro">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.pro</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsoletabwidgetcpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsoletabwidgeth">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginpastebindialogcpp">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/pastebindialog.cpp</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginpastebindialogh">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/pastebindialog.h</a></li>
<li><a href="#freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginpastebindialogui">freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/pastebindialog.ui</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsoleplugincentralWidgetui"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/centralWidget.ui (14615 => 14616)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/centralWidget.ui        2009-08-24 06:02:56 UTC (rev 14615)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/centralWidget.ui        2009-08-24 07:03:42 UTC (rev 14616)
</span><span class="lines">@@ -79,6 +79,7 @@
</span><span class="cx"> <string>&amp;Console</string>
</span><span class="cx"> </property>
</span><span class="cx"> <addaction name="actionRealtime_Statistics"/>
</span><ins>+ <addaction name="action_Pastebin_Log"/>
</ins><span class="cx"> </widget>
</span><span class="cx"> <addaction name="menu_File"/>
</span><span class="cx"> <addaction name="menu_Edit"/>
</span><span class="lines">@@ -93,6 +94,9 @@
</span><span class="cx"> <property name="text">
</span><span class="cx"> <string>&amp;Connect</string>
</span><span class="cx"> </property>
</span><ins>+ <property name="shortcut">
+ <string>Ctrl+C</string>
+ </property>
</ins><span class="cx"> </action>
</span><span class="cx"> <action name="action_Disconnect">
</span><span class="cx"> <property name="enabled">
</span><span class="lines">@@ -101,6 +105,9 @@
</span><span class="cx"> <property name="text">
</span><span class="cx"> <string>&amp;Disconnect</string>
</span><span class="cx"> </property>
</span><ins>+ <property name="shortcut">
+ <string>Ctrl+D</string>
+ </property>
</ins><span class="cx"> </action>
</span><span class="cx"> <action name="action_Close">
</span><span class="cx"> <property name="text">
</span><span class="lines">@@ -114,33 +121,36 @@
</span><span class="cx"> <property name="text">
</span><span class="cx"> <string>&amp;Server Manager</string>
</span><span class="cx"> </property>
</span><ins>+ <property name="shortcut">
+ <string>F4</string>
+ </property>
</ins><span class="cx"> </action>
</span><span class="cx"> <action name="action_Clear">
</span><span class="cx"> <property name="text">
</span><span class="cx"> <string>&amp;Clear</string>
</span><span class="cx"> </property>
</span><span class="cx"> </action>
</span><del>- <action name="actionAutomatic_Scroll">
- <property name="checkable">
- <bool>true</bool>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- <property name="text">
- <string>&amp;Automatic Scroll</string>
- </property>
- </action>
</del><span class="cx"> <action name="actionRealtime_Statistics">
</span><span class="cx"> <property name="text">
</span><span class="cx"> <string>Realtime &amp;Statistics</string>
</span><span class="cx"> </property>
</span><ins>+ <property name="shortcut">
+ <string>F5</string>
+ </property>
</ins><span class="cx"> </action>
</span><span class="cx"> <action name="action_Save_log">
</span><span class="cx"> <property name="text">
</span><span class="cx"> <string>&amp;Save log</string>
</span><span class="cx"> </property>
</span><ins>+ <property name="shortcut">
+ <string>Ctrl+S</string>
+ </property>
</ins><span class="cx"> </action>
</span><ins>+ <action name="action_Pastebin_Log">
+ <property name="text">
+ <string>&amp;Pastebin Log</string>
+ </property>
+ </action>
</ins><span class="cx"> </widget>
</span><span class="cx"> <resources>
</span><span class="cx"> <include location="../../resources/resources.qrc"/>
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsoleplugincpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.cpp (14615 => 14616)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.cpp        2009-08-24 06:02:56 UTC (rev 14615)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.cpp        2009-08-24 07:03:42 UTC (rev 14616)
</span><span class="lines">@@ -31,6 +31,8 @@
</span><span class="cx"> this, SLOT(saveLogToFile()));
</span><span class="cx"> QObject::connect(consoleWindow->actionRealtime_Statistics, SIGNAL(triggered()),
</span><span class="cx"> this, SLOT(showRealtimeStats()));
</span><ins>+ QObject::connect(consoleWindow->action_Pastebin_Log, SIGNAL(triggered()),
+ this, SLOT(pastebinLog()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ConsolePlugin::~ConsolePlugin(){}
</span><span class="lines">@@ -174,6 +176,13 @@
</span><span class="cx"> tab->saveLogToFile();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void ConsolePlugin::pastebinLog()
+{
+ ConsoleTabWidget *tab = qobject_cast<ConsoleTabWidget*>(consoleWindow->tabConsole->currentWidget());
+ if (tab)
+ tab->pastebinLog();
+}
+
</ins><span class="cx"> void ConsolePlugin::showRealtimeStats()
</span><span class="cx"> {
</span><span class="cx"> ConsoleTabWidget *tab = qobject_cast<ConsoleTabWidget*>(consoleWindow->tabConsole->currentWidget());
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsolepluginh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.h (14615 => 14616)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.h        2009-08-24 06:02:56 UTC (rev 14615)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.h        2009-08-24 07:03:42 UTC (rev 14616)
</span><span class="lines">@@ -76,6 +76,7 @@
</span><span class="cx"> void newConnection();
</span><span class="cx"> void clearLogContents();
</span><span class="cx"> void saveLogToFile();
</span><ins>+ void pastebinLog();
</ins><span class="cx"> void showRealtimeStats();
</span><span class="cx"> void changeConsoleBackgroundColor();
</span><span class="cx"> void changeAlertBackgroundColor();
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsolepluginpro"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.pro (14615 => 14616)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.pro        2009-08-24 06:02:56 UTC (rev 14615)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoleplugin.pro        2009-08-24 07:03:42 UTC (rev 14616)
</span><span class="lines">@@ -19,6 +19,7 @@
</span><span class="cx"> win32:INCLUDEPATH += ../../../../../src/include/
</span><span class="cx">
</span><span class="cx"> # #####################################
</span><ins>+QT += network
</ins><span class="cx"> TEMPLATE = lib
</span><span class="cx"> TARGET = consoleplugin
</span><span class="cx"> DESTDIR = ../../../bin/plugins/
</span><span class="lines">@@ -30,16 +31,19 @@
</span><span class="cx"> sortfilterproxymodel.h \
</span><span class="cx"> consoletabwidget.h \
</span><span class="cx"> realtimestatisticsdialog.h \
</span><del>- realtimemodels.h
</del><ins>+ realtimemodels.h \
+ pastebindialog.h
</ins><span class="cx"> SOURCES = consoleplugin.cpp \
</span><span class="cx"> sortfilterproxymodel.cpp \
</span><span class="cx"> consoletabwidget.cpp \
</span><span class="cx"> realtimestatisticsdialog.cpp \
</span><del>- realtimemodels.cpp
</del><ins>+ realtimemodels.cpp \
+ pastebindialog.cpp
</ins><span class="cx"> FORMS += centralWidget.ui \
</span><span class="cx"> console_settings.ui \
</span><span class="cx"> consoletabwidget.ui \
</span><del>- realtimestatisticsdialog.ui
</del><ins>+ realtimestatisticsdialog.ui \
+ pastebindialog.ui
</ins><span class="cx"> LIBS += -L../../interfaces \
</span><span class="cx"> -linterfaces \
</span><span class="cx"> -L../../../../../../libs/esl/ \
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsoletabwidgetcpp"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.cpp (14615 => 14616)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.cpp        2009-08-24 06:02:56 UTC (rev 14615)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.cpp        2009-08-24 07:03:42 UTC (rev 14616)
</span><span class="lines">@@ -3,12 +3,14 @@
</span><span class="cx"> #include "eslconnection.h"
</span><span class="cx"> #include "monitorstatemachine.h"
</span><span class="cx"> #include "realtimestatisticsdialog.h"
</span><ins>+#include "pastebindialog.h"
</ins><span class="cx">
</span><span class="cx"> ConsoleTabWidget::ConsoleTabWidget(QWidget *parent, ESLconnection *eslconnection) :
</span><span class="cx"> QWidget(parent),
</span><span class="cx"> m_ui(new Ui::ConsoleTabWidget),
</span><span class="cx"> esl(eslconnection),
</span><span class="cx"> _rtStatsDlg(NULL),
</span><ins>+ _pastebinDlg(NULL),
</ins><span class="cx"> findNext(false)
</span><span class="cx"> {
</span><span class="cx"> m_ui->setupUi(this);
</span><span class="lines">@@ -354,3 +356,19 @@
</span><span class="cx"> }
</span><span class="cx"> QApplication::restoreOverrideCursor();
</span><span class="cx"> }
</span><ins>+
+void ConsoleTabWidget::pastebinLog()
+{
+ QString text;
+ foreach(QStandardItem *item, sourceModel->modelData())
+ {
+ text.append(item->data(Qt::DisplayRole).toString());
+ text.append("\n");
+ }
+ if (!_pastebinDlg)
+ _pastebinDlg = new pastebinDialog;
+ _pastebinDlg->setText(text);
+ _pastebinDlg->show();
+ _pastebinDlg->raise();
+ _pastebinDlg->activateWindow();
+}
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginconsoletabwidgeth"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.h (14615 => 14616)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.h        2009-08-24 06:02:56 UTC (rev 14615)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/consoletabwidget.h        2009-08-24 07:03:42 UTC (rev 14616)
</span><span class="lines">@@ -52,6 +52,7 @@
</span><span class="cx"> class ESLconnection;
</span><span class="cx"> class MonitorStateMachine;
</span><span class="cx"> class RealtimeStatisticsDialog;
</span><ins>+class pastebinDialog;
</ins><span class="cx">
</span><span class="cx"> class ConsoleTabWidget : public QWidget {
</span><span class="cx"> Q_OBJECT
</span><span class="lines">@@ -63,6 +64,7 @@
</span><span class="cx"> void clearConsoleContents();
</span><span class="cx"> void showRealtimeStats();
</span><span class="cx"> void saveLogToFile();
</span><ins>+ void pastebinLog();
</ins><span class="cx"> void filterLogUUID(QString);
</span><span class="cx">
</span><span class="cx"> protected:
</span><span class="lines">@@ -97,6 +99,7 @@
</span><span class="cx"> ESLconnection *esl;
</span><span class="cx"> MonitorStateMachine *msm;
</span><span class="cx"> RealtimeStatisticsDialog *_rtStatsDlg;
</span><ins>+ pastebinDialog *_pastebinDlg;
</ins><span class="cx"> bool findNext;
</span><span class="cx"> bool autoScroll;
</span><span class="cx"> int currentLogLevel;
</span></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginpastebindialogcpp"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/pastebindialog.cpp (0 => 14616)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/pastebindialog.cpp         (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/pastebindialog.cpp        2009-08-24 07:03:42 UTC (rev 14616)
</span><span class="lines">@@ -0,0 +1,127 @@
</span><ins>+#include <QtGui>
+#include <QtNetwork>
+#include "pastebindialog.h"
+#include "ui_pastebindialog.h"
+
+pastebinDialog::pastebinDialog(QWidget *parent) :
+ QDialog(parent),
+ m_ui(new Ui::pastebinDialog),
+ progressDialog(new QProgressDialog(this))
+{
+ m_ui->setupUi(this);
+
+ connect(this, SIGNAL(accepted()),
+ this, SLOT(pasteIt()));
+}
+
+pastebinDialog::~pastebinDialog()
+{
+ delete m_ui;
+}
+
+void pastebinDialog::changeEvent(QEvent *e)
+{
+ QDialog::changeEvent(e);
+ switch (e->type()) {
+ case QEvent::LanguageChange:
+ m_ui->retranslateUi(this);
+ break;
+ default:
+ break;
+ }
+}
+void pastebinDialog::pasteIt()
+{
+
+ pastebinHttp = new QHttp(this);
+
+ /* TODO: Make a progress thing? */
+ connect(pastebinHttp, SIGNAL(requestFinished(int,bool)),
+ this, SLOT(pastebinFinished(int,bool)));
+ connect(pastebinHttp, SIGNAL(dataSendProgress(int, int)),
+ this, SLOT(updateDataSendProgress(int, int)));
+ connect(pastebinHttp, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)),
+ this, SLOT(readResponseHeader(const QHttpResponseHeader &)));
+
+ QHttpRequestHeader header( "POST", "/pastebin.php") ;
+ header.setValue( "Host", "pastebin.freeswitch.org" ) ;
+ header.setContentType( "application/x-www-form-urlencoded" ) ;
+
+ pastebinHttp->setHost(m_ui->lineURL->text(), QHttp::ConnectionModeHttp, m_ui->linePort->text().toInt());
+ pastebinHttp->setUser(m_ui->lineUsername->text(), m_ui->linePassword->text());
+ header.setValue( "User-Agent", "FsGUI");
+ QString params = QString("parent_pid=&format=fslog&code2=%1").arg(QString(QUrl::toPercentEncoding(text)));
+
+ /* Set the paste user identification */
+ if (m_ui->lineName->text().trimmed().isEmpty())
+ {
+ params += QString("&poster=%1&paste=Send&remember=0").arg(QString(QUrl::toPercentEncoding(tr("Anonymous"))));
+ }
+ else
+ {
+ params += QString("&poster=%1&paste=Send&remember=0").arg(QString(QUrl::toPercentEncoding(m_ui->lineName->text())));
+ }
+
+ /* Set the duration of the paste */
+ if (m_ui->radioDay->isChecked())
+ {
+ params += QString("&expiry=%1").arg("d");
+ }
+ if (m_ui->radioMonth->isChecked())
+ {
+ params += QString("&expiry=%1").arg("m");
+ }
+ if (m_ui->radioForever->isChecked())
+ {
+ params += QString("&expiry=%1").arg("f");
+ }
+ /* Paste it! */
+ postId = pastebinHttp->request(header, params.toAscii());
+ progressDialog->setWindowTitle(tr("Pastebin"));
+ progressDialog->setLabelText(tr("Pasting..."));
+}
+void pastebinDialog::setText(QString consoleText)
+{
+ text = consoleText;
+}
+void pastebinDialog::pastebinFinished(int req, bool /*isError*/)
+{
+ if (req == postId)
+ {
+ progressDialog->hide();
+ QMessageBox::information(this, tr("Sucess"),
+ tr("You pastebin was successful"
+ " and copied to clipboard: %1.")
+ .arg(pasteURL));
+ QApplication::clipboard()->setText(pasteURL);
+ }
+
+}
+void pastebinDialog::updateDataSendProgress(int bytesRead, int totalBytes)
+{
+ progressDialog->setMaximum(totalBytes);
+ progressDialog->setValue(bytesRead);
+}
+void pastebinDialog::readResponseHeader(const QHttpResponseHeader &responseHeader)
+{
+ switch (responseHeader.statusCode())
+ {
+ case 200: // Ok
+ case 301: // Moved Permanently
+ case 303: // See Other
+ case 307: // Temporary Redirect
+ // these are not error conditions
+ break;
+
+ case 302: // Found
+ pasteURL = responseHeader.value("Location");
+ break;
+
+ default:
+ QMessageBox::information(this, tr("HTTP"),
+ tr("Pastebin Failed: %1.")
+ .arg(responseHeader.reasonPhrase()));
+ progressDialog->hide();
+ pastebinHttp->abort();
+ }
+}
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginpastebindialogh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/pastebindialog.h (0 => 14616)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/pastebindialog.h         (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/pastebindialog.h        2009-08-24 07:03:42 UTC (rev 14616)
</span><span class="lines">@@ -0,0 +1,79 @@
</span><ins>+/*
+ * Copyright (c) 2007, Anthony Minessale II
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the original author; nor the names of any contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita <jmesquita (at) freeswitch.org>
+ *
+ */
+#ifndef PASTEBINDIALOG_H
+#define PASTEBINDIALOG_H
+
+#include <QtGui/QDialog>
+
+namespace Ui {
+ class pastebinDialog;
+}
+
+class QHttp;
+class QString;
+class QProgressDialog;
+class QHttpResponseHeader;
+class QStandardItem;
+
+class pastebinDialog : public QDialog {
+ Q_OBJECT
+ Q_DISABLE_COPY(pastebinDialog)
+public:
+ explicit pastebinDialog(QWidget *parent = 0);
+ virtual ~pastebinDialog();
+ void setText(QString);
+
+protected:
+ virtual void changeEvent(QEvent *e);
+
+private:
+ Ui::pastebinDialog *m_ui;
+ QString text;
+ QString pasteURL;
+ QHttp * pastebinHttp;
+ int postId;
+ QProgressDialog *progressDialog;
+
+private slots:
+ void pastebinFinished(int, bool);
+ void pasteIt();
+ void readResponseHeader(const QHttpResponseHeader &);
+ void updateDataSendProgress(int, int);
+};
+
+#endif // PASTEBINDIALOG_H
</ins></span></pre></div>
<a id="freeswitchtrunkcontribjmesquitafsguisrcpluginsconsolepluginpastebindialogui"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/pastebindialog.ui (0 => 14616)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/pastebindialog.ui         (rev 0)
+++ freeswitch/trunk/contrib/jmesquita/fsgui/src/plugins/consoleplugin/pastebindialog.ui        2009-08-24 07:03:42 UTC (rev 14616)
</span><span class="lines">@@ -0,0 +1,234 @@
</span><ins>+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>pastebinDialog</class>
+ <widget class="QDialog" name="pastebinDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>352</width>
+ <height>310</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Pastebin</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="minimumSize">
+ <size>
+ <width>80</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Url</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineURL">
+ <property name="text">
+ <string>pastebin.freeswitch.org</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="minimumSize">
+ <size>
+ <width>80</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Port</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="linePort">
+ <property name="text">
+ <string>80</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="minimumSize">
+ <size>
+ <width>80</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Username</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineUsername">
+ <property name="text">
+ <string>pastebin</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="label_4">
+ <property name="minimumSize">
+ <size>
+ <width>80</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Password</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="linePassword">
+ <property name="text">
+ <string>freeswitch</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Options</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <item>
+ <widget class="QLabel" name="label_5">
+ <property name="minimumSize">
+ <size>
+ <width>80</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Your name</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineName"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_6">
+ <item>
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Paste duration</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="radioDay">
+ <property name="text">
+ <string>A day</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="radioMonth">
+ <property name="text">
+ <string>A month</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="radioForever">
+ <property name="text">
+ <string>Forever</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>pastebinDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>pastebinDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
+
</ins></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>