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