Commit d5021c74 authored by Claudio Valerio's avatar Claudio Valerio

Fixed export to planet sankore

parent 70f6231f
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -21,7 +21,7 @@
#include "ui_webPublishing.h"
#include "UBAbstractPublisher.h"
#define DOCPUBLICATION_URL "http://sankore.devxwiki.com/xwiki/bin/view/CreateResources/UniboardUpload"
#define DOCPUBLICATION_URL "http://sankore.devxwiki.com/xwiki/bin/view/CreateResources/UniboardUpload?xpage=plain&outputSyntax=plain"
#define XWIKI_ORIGIN_HEADER "http://sankore.devxwiki.com"
typedef struct
......@@ -104,21 +104,15 @@ protected:
private slots:
void onFinished(QNetworkReply* reply);
void onLinkClicked(const QUrl& url);
void onLoadFinished(bool result);
void onLoginDone();
void onProxyAuthenticationRequired(const QNetworkProxy & proxy, QAuthenticator * authenticator);
private:
UBDocumentProxy *mSourceDocument;
UBDocumentProxy *mPublishingDocument;
void init();
void sendUbw();
void sendUbw(QString username, QString password);
QString getBase64Of(QString stringToEncode);
QWebView* mpWebView;
QHBoxLayout* mpLayout;
QNetworkAccessManager* mpNetworkMgr;
QNetworkCookieJar* mpCookieJar;
......@@ -128,7 +122,6 @@ private:
bool bLoginCookieSet;
void buildUbwFile();
void login(QString username, QString password);
QString mTmpZipFile;
QList<QNetworkCookie> mCookies;
sDocumentInfos mDocInfos;
......
......@@ -349,11 +349,6 @@ void UBApplication::showDocument()
applicationController->showDocument();
}
void UBApplication::showSankoreWebDocument()
{
applicationController->showSankoreWebDocument();
}
int UBApplication::toolBarHeight()
{
return mainWindow->boardToolBar->rect().height();
......
......@@ -96,7 +96,6 @@ class UBApplication : public QtSingleApplication
void showBoard();
void showInternet();
void showDocument();
void showSankoreWebDocument();
void toolBarPositionChanged(QVariant topOrBottom);
void toolBarDisplayTextChanged(QVariant display);
......
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "UBApplicationController.h"
#include "frameworks/UBPlatformUtils.h"
......@@ -365,7 +365,7 @@ void UBApplicationController::showInternet()
{
showDesktop(true);
}
else
else
{
mMainWindow->boardToolBar->hide();
mMainWindow->documentToolBar->hide();
......@@ -417,33 +417,6 @@ void UBApplicationController::showDocument()
emit mainModeChanged(Document);
}
void UBApplicationController::showSankoreWebDocument()
{
mMainWindow->webToolBar->hide();
mMainWindow->boardToolBar->hide();
mMainWindow->tutorialToolBar->hide();
mMainWindow->documentToolBar->show();
mMainMode = WebDocument;
adaptToolBar();
mirroringEnabled(false);
mMainWindow->switchToSankoreWebDocumentWidget();
UBApplication::documentController->hide();
mMainWindow->show();
mUninoteController->hideWindow();
emit mainModeChanged(WebDocument);
}
void UBApplicationController::showDesktop(bool dontSwitchFrontProcess)
{
int desktopWidgetIndex = qApp->desktop()->screenNumber(mMainWindow);
......
......@@ -66,8 +66,6 @@ class UBApplicationController : public QObject
void showDocument();
void showSankoreWebDocument();
void showMessage(const QString& message, bool showSpinningWheel);
void importFile(const QString& pFilePath);
......
......@@ -36,6 +36,27 @@ qreal UBPreferencesController::sSliderRatio = 10.0;
qreal UBPreferencesController::sMinPenWidth = 0.5;
qreal UBPreferencesController::sMaxPenWidth = 50.0;
UBPreferencesDialog::UBPreferencesDialog(UBPreferencesController* prefController, QWidget* parent,Qt::WindowFlags f)
:QDialog(parent,f)
,mPreferencesController(prefController)
{
}
UBPreferencesDialog::~UBPreferencesDialog()
{
}
void UBPreferencesDialog::closeEvent(QCloseEvent* e)
{
if(mPreferencesController->inputValuesConsistence())
e->accept();
else
e->ignore();
}
UBPreferencesController::UBPreferencesController(QWidget *parent)
: QObject(parent)
, mPreferencesWindow(0)
......@@ -43,8 +64,9 @@ UBPreferencesController::UBPreferencesController(QWidget *parent)
, mPenProperties(0)
, mMarkerProperties(0)
{
mPreferencesWindow = new QDialog(parent, Qt::Dialog);
mPreferencesUI = new Ui::preferencesDialog(); // deleted in UBPreferencesController::destructor
mPreferencesWindow = new UBPreferencesDialog(this,parent, Qt::Dialog);
// mPreferencesWindow = new QDialog(parent, Qt::Dialog);
mPreferencesUI = new Ui::preferencesDialog(); // deleted in
mPreferencesUI->setupUi(mPreferencesWindow);
connect(mPreferencesUI->Username_textBox, SIGNAL(editingFinished()), this, SLOT(onCommunityUsernameChanged()));
connect(mPreferencesUI->Password_textEdit, SIGNAL(editingFinished()), this, SLOT(onCommunityPasswordChanged()));
......@@ -108,8 +130,8 @@ void UBPreferencesController::wire()
QList<QColor> penDarkBackgroundSelectedColors = settings->boardPenDarkBackgroundSelectedColors->colors();
mPenProperties = new UBBrushPropertiesFrame(mPreferencesUI->penFrame,
penLightBackgroundColors, penDarkBackgroundColors, penLightBackgroundSelectedColors,
penDarkBackgroundSelectedColors, this);
penLightBackgroundColors, penDarkBackgroundColors, penLightBackgroundSelectedColors,
penDarkBackgroundSelectedColors, this);
mPenProperties->opacityFrame->hide();
......@@ -125,8 +147,8 @@ void UBPreferencesController::wire()
QList<QColor> markerDarkBackgroundSelectedColors = settings->boardMarkerDarkBackgroundSelectedColors->colors();
mMarkerProperties = new UBBrushPropertiesFrame(mPreferencesUI->markerFrame, markerLightBackgroundColors,
markerDarkBackgroundColors, markerLightBackgroundSelectedColors,
markerDarkBackgroundSelectedColors, this);
markerDarkBackgroundColors, markerLightBackgroundSelectedColors,
markerDarkBackgroundSelectedColors, this);
mMarkerProperties->pressureSensitiveCheckBox->setText(tr("Marker is pressure sensitive"));
......@@ -151,7 +173,7 @@ void UBPreferencesController::init()
mPreferencesUI->keyboardPaletteAutoMinimize->setChecked(settings->boardKeyboardPaletteAutoMinimize->get().toBool());
for(int i=0; i<mPreferencesUI->keyboardPaletteKeyButtonSize->count(); i++)
if (mPreferencesUI->keyboardPaletteKeyButtonSize->itemText(i) ==
settings->boardKeyboardPaletteKeyBtnSize->get().toString())
settings->boardKeyboardPaletteKeyBtnSize->get().toString())
{
mPreferencesUI->keyboardPaletteKeyButtonSize->setCurrentIndex(i);
break;
......@@ -201,15 +223,48 @@ void UBPreferencesController::onCommunityPasswordChanged()
settings->setCommunityPassword(mPreferencesUI->Password_textEdit->text());
}
bool UBPreferencesController::inputValuesConsistence()
{
QString backgroundStyle = "QWidget {background-color: white}";
mPreferencesUI->Username_textBox->setStyleSheet(backgroundStyle);
mPreferencesUI->Password_textEdit->setStyleSheet(backgroundStyle);
QString username = mPreferencesUI->Username_textBox->text();
QString password = mPreferencesUI->Password_textEdit->text();
bool isConsistent = true;
if (username.length() + password.length()){
backgroundStyle = "QWidget {background-color: magenta}";
if(username.isEmpty()){
isConsistent = false;
mPreferencesUI->mainTabWidget->setCurrentWidget(mPreferencesUI->networkTab);
mPreferencesUI->Username_textBox->setStyleSheet(backgroundStyle);
mPreferencesUI->Username_textBox->setFocus();
mPreferencesUI->Username_textBox->setCursorPosition(0);
}
else if(password.isEmpty()){
isConsistent = false;
mPreferencesUI->mainTabWidget->setCurrentWidget(mPreferencesUI->networkTab);
mPreferencesUI->Password_textEdit->setStyleSheet(backgroundStyle);
mPreferencesUI->Password_textEdit->setFocus();
mPreferencesUI->Password_textEdit->setCursorPosition(0);
}
}
return isConsistent;
}
void UBPreferencesController::close()
{
//web
QString homePage = mPreferencesUI->webHomePage->text();
UBSettings::settings()->webHomePage->set(homePage);
UBSettings::settings()->webHomePage->set(homePage);
UBSettings::settings()->setProxyUsername(mPreferencesUI->proxyUsername->text());
UBSettings::settings()->setProxyPassword(mPreferencesUI->proxyPassword->text());
if (!inputValuesConsistence())
return;
mPreferencesWindow->accept();
}
......@@ -253,8 +308,8 @@ void UBPreferencesController::defaultSettings()
for (int i = 0 ; i < settings->colorPaletteSize ; i++)
{
mPenProperties->lightBackgroundColorPickers[i]->setSelectedColorIndex(lightBackgroundSelectedColors.indexOf(settings->penColors(false).at(i)));
mPenProperties->darkBackgroundColorPickers[i]->setSelectedColorIndex(darkBackgroundSelectedColors.indexOf(settings->penColors(true).at(i)));
mPenProperties->lightBackgroundColorPickers[i]->setSelectedColorIndex(lightBackgroundSelectedColors.indexOf(settings->penColors(false).at(i)));
mPenProperties->darkBackgroundColorPickers[i]->setSelectedColorIndex(darkBackgroundSelectedColors.indexOf(settings->penColors(true).at(i)));
}
}
else if (mPreferencesUI->mainTabWidget->currentWidget() == mPreferencesUI->markerTab)
......@@ -274,8 +329,8 @@ void UBPreferencesController::defaultSettings()
for (int i = 0 ; i < settings->colorPaletteSize ; i++)
{
mMarkerProperties->lightBackgroundColorPickers[i]->setSelectedColorIndex(lightBackgroundSelectedColors.indexOf(settings->markerColors(false).at(i)));
mMarkerProperties->darkBackgroundColorPickers[i]->setSelectedColorIndex(darkBackgroundSelectedColors.indexOf(settings->markerColors(true).at(i)));
mMarkerProperties->lightBackgroundColorPickers[i]->setSelectedColorIndex(lightBackgroundSelectedColors.indexOf(settings->markerColors(false).at(i)));
mMarkerProperties->darkBackgroundColorPickers[i]->setSelectedColorIndex(darkBackgroundSelectedColors.indexOf(settings->markerColors(true).at(i)));
}
}
else if (mPreferencesUI->mainTabWidget->currentWidget() == mPreferencesUI->aboutTab)
......@@ -412,8 +467,8 @@ void UBPreferencesController::toolbarOrientationHorizontal(bool checked)
}
UBBrushPropertiesFrame::UBBrushPropertiesFrame(QFrame* owner, const QList<QColor>& lightBackgroundColors,
const QList<QColor>& darkBackgroundColors, const QList<QColor>& lightBackgroundSelectedColors,
const QList<QColor>& darkBackgroundSelectedColors, UBPreferencesController* controller)
const QList<QColor>& darkBackgroundColors, const QList<QColor>& lightBackgroundSelectedColors,
const QList<QColor>& darkBackgroundSelectedColors, UBPreferencesController* controller)
{
setupUi(owner);
......@@ -485,4 +540,3 @@ UBBrushPropertiesFrame::UBBrushPropertiesFrame(QFrame* owner, const QList<QColor
}
}
......@@ -21,6 +21,7 @@
class UBColorPicker;
class UBApplication;
class UBSettings;
class UBPreferencesController;
namespace Ui
{
......@@ -31,6 +32,21 @@ namespace Ui
class UBBrushPropertiesFrame;
class UBPreferencesDialog : public QDialog
{
Q_OBJECT;
public:
UBPreferencesDialog(UBPreferencesController* prefController, QWidget* parent = 0,Qt::WindowFlags f = 0 );
~UBPreferencesDialog();
protected:
void closeEvent(QCloseEvent* e);
UBPreferencesController *mPreferencesController;
};
class UBPreferencesController : public QObject
{
Q_OBJECT;
......@@ -39,6 +55,8 @@ class UBPreferencesController : public QObject
UBPreferencesController(QWidget *parent);
virtual ~UBPreferencesController();
bool inputValuesConsistence();
public slots:
void show();
......@@ -48,7 +66,7 @@ class UBPreferencesController : public QObject
void wire();
void init();
QDialog* mPreferencesWindow;
UBPreferencesDialog* mPreferencesWindow;
Ui::preferencesDialog* mPreferencesUI;
UBBrushPropertiesFrame* mPenProperties;
UBBrushPropertiesFrame* mMarkerProperties;
......@@ -78,9 +96,7 @@ class UBBrushPropertiesFrame : public Ui::brushProperties
{
public:
UBBrushPropertiesFrame(QFrame* owner, const QList<QColor>& lightBackgroundColors,
const QList<QColor>& darkBackgroundColors, const QList<QColor>& lightBackgroundSelectedColors,
const QList<QColor>& darkBackgroundSelectedColors, UBPreferencesController* controller);
UBBrushPropertiesFrame(QFrame* owner, const QList<QColor>& lightBackgroundColors,const QList<QColor>& darkBackgroundColors, const QList<QColor>& lightBackgroundSelectedColors,const QList<QColor>& darkBackgroundSelectedColors, UBPreferencesController* controller);
virtual ~UBBrushPropertiesFrame(){}
......
......@@ -43,7 +43,7 @@ UBMainWindow::UBMainWindow(QWidget *parent, Qt::WindowFlags flags)
actionPreferences->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Return));
actionQuit->setShortcut(QKeySequence(Qt::ALT + Qt::Key_F4));
#else
// No shortcut on Linux (like GEdit/Nautilius)
actionQuit->setShortcut(QKeySequence(Qt::ALT + Qt::Key_F4));
#endif
}
......@@ -106,19 +106,6 @@ void UBMainWindow::switchToDocumentsWidget()
}
}
void UBMainWindow::addSankoreWebDocumentWidget(QWebView* pWidget)
{
if(!mSankoreWebDocumentWidget){
mSankoreWebDocumentWidget = pWidget;
mStackedLayout->addWidget(mSankoreWebDocumentWidget);
}
}
void UBMainWindow::switchToSankoreWebDocumentWidget()
{
if(mSankoreWebDocumentWidget)
mStackedLayout->setCurrentWidget(mSankoreWebDocumentWidget);
}
void UBMainWindow::keyPressEvent(QKeyEvent *event)
{
QMainWindow::keyPressEvent(event);
......
......@@ -42,9 +42,6 @@ class UBMainWindow : public QMainWindow, public Ui::MainWindow
void addDocumentsWidget(QWidget *pWidget);
void switchToDocumentsWidget();
void addSankoreWebDocumentWidget(QWebView* pWidget);
void switchToSankoreWebDocumentWidget();
public slots:
void onExportDone();
......
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