Commit 89b3f821 authored by hjk's avatar hjk
Browse files

cpaster: compile fix for namespaced qt plus code cosmetics

QListWidget forward declaration was not namespaced.
parent 1e64d9f9
......@@ -29,6 +29,7 @@
#ifndef CODEPASTERPROTOCOL_H
#define CODEPASTERPROTOCOL_H
#include "protocol.h"
#include <QtGui/QListWidget>
......@@ -38,7 +39,7 @@
namespace CodePaster {
class CodePasterSettingsPage;
class CodePasterSettingsPage;
class CodePasterProtocol : public Protocol
{
......@@ -51,28 +52,29 @@ public:
bool canList() const;
bool hasSettings() const;
Core::IOptionsPage* settingsPage();
Core::IOptionsPage *settingsPage();
void fetch(const QString &id);
void list(QListWidget *listWidget);
void paste(const QString &text,
const QString &username = "",
const QString &comment = "",
const QString &description = "");
const QString &username = QString(),
const QString &comment = QString(),
const QString &description = QString());
public slots:
void fetchFinished();
void listFinished();
void readPostResponseHeader(const QHttpResponseHeader&);
void readPostResponseHeader(const QHttpResponseHeader &);
private:
CodePasterSettingsPage *m_page;
QHttp http;
QNetworkAccessManager manager;
QNetworkReply* reply;
QNetworkReply* listReply;
QListWidget* listWidget;
QNetworkReply *reply;
QNetworkReply *listReply;
QListWidget *listWidget;
QString fetchId;
};
}
} // namespace CodePaster
#endif // CODEPASTERPROTOCOL_H
......@@ -178,11 +178,11 @@ void CodepasterPlugin::post()
if (!view.show(username, description, comment, lst))
return; // User canceled post
username = view.getUser();
description = view.getDescription();
comment = view.getComment();
data = view.getContent();
protocolName = view.getProtocol();
username = view.user();
description = view.description();
comment = view.comment();
data = view.content();
protocolName = view.protocol();
// Copied from cpaster. Otherwise lineendings will screw up
if (!data.contains("\r\n")) {
......
......@@ -29,7 +29,9 @@
#ifndef PASTEBINDOTCAPROTOCOL_H
#define PASTEBINDOTCAPROTOCOL_H
#include "protocol.h"
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkReply>
#include <QtNetwork/QHttp>
......@@ -46,9 +48,9 @@ public:
void fetch(const QString &id);
void paste(const QString &text,
const QString &username = "",
const QString &comment = "",
const QString &description = "");
const QString &username = QString(),
const QString &comment = QString(),
const QString &description = QString());
public slots:
void fetchFinished();
......
......@@ -29,7 +29,9 @@
#ifndef PASTEBINDOTCOMPROTOCOL_H
#define PASTEBINDOTCOMPROTOCOL_H
#include "protocol.h"
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkReply>
#include <QtNetwork/QHttp>
......@@ -51,14 +53,14 @@ public:
void fetch(const QString &id);
void paste(const QString &text,
const QString &username = "",
const QString &comment = "",
const QString &description = "");
const QString &username = QString(),
const QString &comment = QString(),
const QString &description = QString());
public slots:
void fetchFinished();
void postRequestFinished(int id, bool error);
void readPostResponseHeader(const QHttpResponseHeader&);
void readPostResponseHeader(const QHttpResponseHeader &);
private:
PasteBinDotComSettings *settings;
......
......@@ -94,7 +94,7 @@ PasteView::~PasteView()
{
}
QString PasteView::getUser()
QString PasteView::user() const
{
const QString username = m_ui.uiUsername->text();
if (username.isEmpty() || username == tr("<Username>"))
......@@ -102,7 +102,7 @@ QString PasteView::getUser()
return username;
}
QString PasteView::getDescription()
QString PasteView::description() const
{
const QString description = m_ui.uiDescription->text();
if (description == tr("<Description>"))
......@@ -110,7 +110,7 @@ QString PasteView::getDescription()
return description;
}
QString PasteView::getComment()
QString PasteView::comment() const
{
const QString comment = m_ui.uiComment->toPlainText();
if (comment == tr("<Comment>"))
......@@ -118,7 +118,7 @@ QString PasteView::getComment()
return comment;
}
QByteArray PasteView::getContent()
QByteArray PasteView::content() const
{
QByteArray newContent;
for (int i = 0; i < m_ui.uiPatchList->count(); ++i) {
......@@ -129,14 +129,14 @@ QByteArray PasteView::getContent()
return newContent;
}
QString PasteView::getProtocol()
QString PasteView::protocol() const
{
return m_ui.protocolBox->currentText();
}
void PasteView::contentChanged()
{
m_ui.uiPatchView->setPlainText(getContent());
m_ui.uiPatchView->setPlainText(content());
}
int PasteView::show(const QString &user, const QString &description, const QString &comment,
......
......@@ -30,12 +30,12 @@
#ifndef PASTEVIEW_H
#define PASTEVIEW_H
#include <QDialog>
#include <QByteArray>
#include "splitter.h"
#include "ui_pasteview.h"
#include <QDialog>
#include <QByteArray>
class PasteView : public QDialog
{
Q_OBJECT
......@@ -48,11 +48,11 @@ public:
void addProtocol(const QString &protocol, bool defaultProtocol = false);
QString getUser();
QString getDescription();
QString getComment();
QByteArray getContent();
QString getProtocol();
QString user() const;
QString description() const;
QString comment() const;
QByteArray content() const;
QString protocol() const;
private slots:
void contentChanged();
......
......@@ -26,8 +26,10 @@
** contact the sales department at http://www.qtsoftware.com/contact.
**
**************************************************************************/
#ifndef PROTOCOL_H
#define PROTOCOL_H
#include "settingspage.h"
#include <coreplugin/dialogs/ioptionspage.h>
......@@ -35,7 +37,9 @@
#include <QtCore/QObject>
#include <QtCore/QString>
QT_BEGIN_NAMESPACE
class QListWidget;
QT_END_NAMESPACE
class Protocol : public QObject
{
......@@ -55,9 +59,9 @@ public:
virtual void fetch(const QString &id) = 0;
virtual void list(QListWidget *listWidget);
virtual void paste(const QString &text,
const QString &username = "",
const QString &comment = "",
const QString &description = "") = 0;
const QString &username = QString(),
const QString &comment = QString(),
const QString &description = QString()) = 0;
signals:
void pasteDone(const QString &link);
......
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