Using the preference dialog to store the community username & password + adding arabian translation file

preferencesAboutTextFull
shibakaneki 14 years ago
parent b650a8af79
commit 91af774814
  1. 2627
      resources/i18n/sankore_ar.ts
  2. 6
      src/adaptors/publishing/UBDocumentPublisher.cpp
  3. 20
      src/api/UBWidgetUniboardAPI.cpp
  4. 3
      src/api/UBWidgetUniboardAPI.h
  5. 17
      src/core/UBPreferencesController.cpp
  6. 2
      src/core/UBPreferencesController.h
  7. 22
      src/core/UBSettings.cpp
  8. 8
      src/core/UBSettings.h
  9. 2
      src/domain/UBGraphicsWidgetItem.cpp
  10. 2
      src/domain/UBW3CWidget.cpp
  11. 2
      src/gui/UBToolWidget.cpp

File diff suppressed because it is too large Load Diff

@ -60,8 +60,10 @@ UBDocumentPublisher::~UBDocumentPublisher()
void UBDocumentPublisher::publish()
{
//check that the username and password are stored on preferences
mUsername = "Admin";
mPassword = "admin";
UBSettings* settings = UBSettings::settings();
mUsername = settings->communityUsername();
mPassword = settings->communityPassword();
buildUbwFile();
UBApplication::showMessage(tr("Uploading Sankore File on Web."));
sendUbw();

@ -375,6 +375,26 @@ QString UBWidgetUniboardAPI::lang()
return lang;
}
void UBWidgetUniboardAPI::returnStatus(const QString& method, const QString& status)
{
QString msg = QString(tr("%0 called (method=%1, status=%2)")).arg("returnStatus").arg(method).arg(status);
UBApplication::showMessage(msg);
}
void UBWidgetUniboardAPI::usedMethods(QStringList methods)
{
// TODO: Implement this method
foreach(QString method, methods)
{
}
}
void UBWidgetUniboardAPI::response(bool correct)
{
Q_UNUSED(correct);
// TODO: Implement this method
}
UBDocumentDatastoreAPI::UBDocumentDatastoreAPI(UBGraphicsW3CWidgetItem *graphicsWidget)

@ -207,6 +207,9 @@ class UBWidgetUniboardAPI : public QObject
void addText(const QString& text, const qreal x, const qreal y, const int height = -1, const QString& font = ""
, bool bold = false, bool italic = false);
void returnStatus(const QString& method, const QString& status);
void usedMethods(QStringList methods);
void response(bool correct);
private:
QString uuid();

@ -38,6 +38,8 @@ UBPreferencesController::UBPreferencesController(QWidget *parent)
mPreferencesWindow = new QDialog(parent, Qt::Dialog);
mPreferencesUI = new Ui::preferencesDialog(); // deleted in UBPreferencesController::destructor
mPreferencesUI->setupUi(mPreferencesWindow);
connect(mPreferencesUI->Username_textBox, SIGNAL(editingFinished()), this, SLOT(onCommunityUsernameChanged()));
connect(mPreferencesUI->Password_textEdit, SIGNAL(editingFinished()), this, SLOT(onCommunityPasswordChanged()));
wire();
}
@ -160,6 +162,9 @@ void UBPreferencesController::init()
mPreferencesUI->verticalChoice->setChecked(settings->appToolBarOrientationVertical->get().toBool());
mPreferencesUI->horizontalChoice->setChecked(!settings->appToolBarOrientationVertical->get().toBool());
mPreferencesUI->Username_textBox->setText(settings->communityUsername());
mPreferencesUI->Password_textEdit->setText(settings->communityPassword());
// pen tab
mPenProperties->fineSlider->setValue(settings->boardPenFineWidth->get().toDouble() * sSliderRatio);
mPenProperties->mediumSlider->setValue(settings->boardPenMediumWidth->get().toDouble() * sSliderRatio);
@ -176,6 +181,18 @@ void UBPreferencesController::init()
}
void UBPreferencesController::onCommunityUsernameChanged()
{
UBSettings* settings = UBSettings::settings();
settings->setCommunityUsername(mPreferencesUI->Username_textBox->text());
}
void UBPreferencesController::onCommunityPasswordChanged()
{
UBSettings* settings = UBSettings::settings();
settings->setCommunityPassword(mPreferencesUI->Password_textEdit->text());
}
void UBPreferencesController::close()
{
//web

@ -55,6 +55,8 @@ class UBPreferencesController : public QObject
void toolbarPositionChanged(bool checked);
void toolbarOrientationVertical(bool checked);
void toolbarOrientationHorizontal(bool checked);
void onCommunityUsernameChanged();
void onCommunityPasswordChanged();
private:

@ -313,6 +313,9 @@ void UBSettings::init()
uniboardWebAuthor = new UBSetting(this, "UniboardWeb", "Author", "");
uniboardWebGoogleMapApiKey = new UBSetting(this, "UniboardWeb", "GoogleMapAPIKey", "ABQIAAAAsWU4bIbaeCLinpZ30N_erRQEk562OPinwQkG9J-ZXUNAqYhJ5RT_z2EmpfVXiUg8c41BcsD_XM6P5g");
communityUser = new UBSetting(this, "Community", "Username", "");
communityPsw = new UBSetting(this, "Community", "Password", "");
QStringList uris = UBToolsManager::manager()->allToolIDs();
favoritesNativeToolUris = new UBSetting(this, "App", "FavoriteToolURIs", uris);
@ -1292,3 +1295,22 @@ void UBSettings::setProxyPassword(const QString& password)
}
QString UBSettings::communityUsername()
{
return communityUser->get().toString();
}
void UBSettings::setCommunityUsername(const QString &username)
{
communityUser->set(QVariant(username));
}
QString UBSettings::communityPassword()
{
return communityPsw->get().toString();
}
void UBSettings::setCommunityPassword(const QString &password)
{
communityPsw->set(QVariant(password));
}

@ -89,6 +89,11 @@ class UBSettings : public QObject
QString proxyPassword();
void setProxyPassword(const QString& password);
QString communityUsername();
void setCommunityUsername(const QString& username);
QString communityPassword();
void setCommunityPassword(const QString& password);
void init();
static QString uniboardDataDirectory();
@ -315,6 +320,9 @@ class UBSettings : public QObject
UBSetting* navigPaletteWidth;
UBSetting* libPaletteWidth;
UBSetting* communityUser;
UBSetting* communityPsw;
/*
static int navigPaletteWidth;
static int libPaletteWidth;

@ -36,7 +36,7 @@ void UBGraphicsWidgetItem::javaScriptWindowObjectCleared()
if(!mUniboardAPI)
mUniboardAPI = new UBWidgetUniboardAPI(scene(), this);
mWebKitWidget->page()->mainFrame()->addToJavaScriptWindowObject("uniboard", mUniboardAPI);
mWebKitWidget->page()->mainFrame()->addToJavaScriptWindowObject("sankore", mUniboardAPI);
}

@ -169,7 +169,7 @@ void UBW3CWidget::javaScriptWindowObjectCleared()
{
UBWidgetUniboardAPI *uniboardAPI = new UBWidgetUniboardAPI(UBApplication::boardController->activeScene(), 0);
page()->mainFrame()->addToJavaScriptWindowObject("uniboard", uniboardAPI);
page()->mainFrame()->addToJavaScriptWindowObject("sankore", uniboardAPI);
UBWidgetVotingSystemAPI *votingSystem = new UBWidgetVotingSystemAPI(this);
page()->mainFrame()->addToJavaScriptWindowObject("voting", votingSystem);

@ -120,7 +120,7 @@ void UBToolWidget::javaScriptWindowObjectCleared()
{
UBWidgetUniboardAPI* uniboardAPI = new UBWidgetUniboardAPI(UBApplication::boardController->activeScene());
mToolWidget->page()->mainFrame()->addToJavaScriptWindowObject("uniboard", uniboardAPI);
mToolWidget->page()->mainFrame()->addToJavaScriptWindowObject("sankore", uniboardAPI);
UBW3CWidget* w3c = dynamic_cast<UBW3CWidget*>(mToolWidget);
if (w3c)

Loading…
Cancel
Save