Hi guys, i saw the problem listed in bugtracker (#1101) and I am sending some patchs.
From 49ecb1c6f3a07a3733c20b808433711c5ec7d420 Mon Sep 17 00:00:00 2001 From: Edi Anderson Lobo <[email protected]> Date: Sat, 15 Oct 2016 00:33:08 -0300 Subject: [PATCH 3/4] Changed message.
I changed the message of success on login with facebook. Signed-off-by: Edi Anderson Lobo <[email protected]> --- desktop-widgets/plugins/facebook/facebookconnectwidget.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/desktop-widgets/plugins/facebook/facebookconnectwidget.h b/desktop-widgets/plugins/facebook/facebookconnectwidget.h index e970978..91208cd 100644 --- a/desktop-widgets/plugins/facebook/facebookconnectwidget.h +++ b/desktop-widgets/plugins/facebook/facebookconnectwidget.h @@ -50,6 +50,10 @@ public: SocialNetworkDialog(QWidget *parent = 0); QString text() const; QString album() const; + +private: + void shallEnableCheckBoxes() ; + public slots: void selectionChanged(); void albumChanged(); -- 2.10.0
From 50ccdba674498cec66d4beb9643f831cc6145088 Mon Sep 17 00:00:00 2001 From: Edi Anderson Lobo <[email protected]> Date: Fri, 14 Oct 2016 23:49:06 -0300 Subject: [PATCH 1/4] Checkbox disabled. I disabled the checkbox to activate them during the runtime. So when the data associated with checkbox is not null, the checkbox is enabled. So null data will not be sent to facebook Signed-off-by: Edi Anderson Lobo <[email protected]> --- .../plugins/facebook/socialnetworksdialog.ui | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/desktop-widgets/plugins/facebook/socialnetworksdialog.ui b/desktop-widgets/plugins/facebook/socialnetworksdialog.ui index e8953d1..e4b8c3a 100644 --- a/desktop-widgets/plugins/facebook/socialnetworksdialog.ui +++ b/desktop-widgets/plugins/facebook/socialnetworksdialog.ui @@ -87,6 +87,9 @@ </item> <item row="5" column="0"> <widget class="QCheckBox" name="date"> + <property name="enabled"> + <bool>false</bool> + </property> <property name="text"> <string>Date and time</string> </property> @@ -94,6 +97,9 @@ </item> <item row="6" column="0"> <widget class="QCheckBox" name="duration"> + <property name="enabled"> + <bool>false</bool> + </property> <property name="text"> <string>Duration</string> </property> @@ -101,6 +107,9 @@ </item> <item row="7" column="0"> <widget class="QCheckBox" name="Location"> + <property name="enabled"> + <bool>false</bool> + </property> <property name="text"> <string>Location</string> </property> @@ -108,6 +117,9 @@ </item> <item row="8" column="0"> <widget class="QCheckBox" name="Divemaster"> + <property name="enabled"> + <bool>false</bool> + </property> <property name="text"> <string>Divemaster</string> </property> @@ -115,6 +127,9 @@ </item> <item row="9" column="0"> <widget class="QCheckBox" name="Buddy"> + <property name="enabled"> + <bool>false</bool> + </property> <property name="text"> <string>Buddy</string> </property> @@ -122,6 +137,9 @@ </item> <item row="10" column="0"> <widget class="QCheckBox" name="Notes"> + <property name="enabled"> + <bool>false</bool> + </property> <property name="text"> <string>Notes</string> </property> -- 2.10.0
From 8a136d88089390d20ff6ea713e2e21140e012531 Mon Sep 17 00:00:00 2001 From: Edi Anderson Lobo <[email protected]> Date: Sat, 15 Oct 2016 00:45:04 -0300 Subject: [PATCH 4/4] Added validation. Added an new method for validate the values to be sending for facebook. Signed-off-by: Edi Anderson Lobo <[email protected]> --- .../plugins/facebook/facebookconnectwidget.cpp | 78 ++++++++++++++-------- 1 file changed, 50 insertions(+), 28 deletions(-) diff --git a/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp b/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp index e0d2aab..d976c45 100644 --- a/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp +++ b/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp @@ -160,8 +160,9 @@ void FacebookManager::setDesiredAlbumName(const QString& a) void FacebookManager::sendDive() { SocialNetworkDialog dialog(qApp->activeWindow()); - if (dialog.exec() != QDialog::Accepted) + if (dialog.exec() != QDialog::Accepted){ return; + } setDesiredAlbumName(dialog.album()); requestAlbumId(); @@ -237,10 +238,13 @@ FacebookConnectWidget::FacebookConnectWidget(QWidget *parent) : QDialog(parent), void FacebookConnectWidget::facebookLoggedIn() { - ui->fbWebviewContainer->hide(); - ui->fbWebviewContainer->setEnabled(false); - ui->FBLabel->setText(tr("To disconnect Subsurface from your Facebook account, use the button below")); -} + hide(); + QMessageBox::information(this, + tr("Facebook Login"), + tr("Your loggin on Facebook was realized with sucess."), + QMessageBox::Ok); + close(); + } void FacebookConnectWidget::facebookDisconnect() { @@ -268,6 +272,25 @@ SocialNetworkDialog::SocialNetworkDialog(QWidget *parent) : connect(ui->Location, SIGNAL(clicked()), this, SLOT(selectionChanged())); connect(ui->Notes, SIGNAL(clicked()), this, SLOT(selectionChanged())); connect(ui->album, SIGNAL(textChanged(QString)), this, SLOT(albumChanged())); + shallEnableCheckBoxes(); +} + +void SocialNetworkDialog::shallEnableCheckBoxes() +{ + struct dive *d = current_dive; + if(d != NULL){ + ui->duration->setEnabled(true); + if (get_short_dive_date_string(d->when) != "" ) + ui->date->setEnabled(true); + if (get_dive_location(d) != NULL) + ui->Location->setEnabled(true); + if (d->buddy != NULL) + ui->Buddy->setEnabled(true); + if (d->divemaster != NULL) + ui->Divemaster->setEnabled(true); + if ( d->notes != NULL) + ui->Notes->setEnabled(true); + } } void SocialNetworkDialog::albumChanged() @@ -279,27 +302,28 @@ void SocialNetworkDialog::albumChanged() void SocialNetworkDialog::selectionChanged() { struct dive *d = current_dive; - QString fullText; - if (ui->date->isChecked()) { - fullText += tr("Dive date: %1 \n").arg(get_short_dive_date_string(d->when)); - } - if (ui->duration->isChecked()) { - fullText += tr("Duration: %1 \n").arg(get_dive_duration_string(d->duration.seconds, - tr("h:", "abbreviation for hours plus separator"), - tr("min", "abbreviation for minutes"))); - } - if (ui->Location->isChecked()) { - fullText += tr("Dive location: %1 \n").arg(get_dive_location(d)); - } - if (ui->Buddy->isChecked()) { - fullText += tr("Buddy: %1 \n").arg(d->buddy); - } - if (ui->Divemaster->isChecked()) { - fullText += tr("Divemaster: %1 \n").arg(d->divemaster); - } - if (ui->Notes->isChecked()) { - fullText += tr("\n%1").arg(d->notes); - } + QString fullText; + + if (ui->date->isChecked()) { + fullText += tr("Dive date: %1 \n").arg(get_short_dive_date_string(d->when) ); + } + if (ui->duration->isChecked()) { + fullText += tr("Duration: %1 \n").arg(get_dive_duration_string(d->duration.seconds, + tr("h:", "abbreviation for hours plus separator"), + tr("min", "abbreviation for minutes"))); + } + if (ui->Location->isChecked()) { + fullText += tr("Dive location: %1 \n").arg(get_dive_location(d)); + } + if (ui->Buddy->isChecked()) { + fullText += tr("Buddy: %1 \n").arg(d->buddy); + } + if (ui->Divemaster->isChecked()) { + fullText += tr("Divemaster: %1 \n").arg(d->divemaster); + } + if (ui->Notes->isChecked()) { + fullText += tr("\n%1").arg(d->notes); + } ui->text->setPlainText(fullText); } @@ -310,5 +334,3 @@ QString SocialNetworkDialog::text() const { QString SocialNetworkDialog::album() const { return ui->album->text().toHtmlEscaped(); } - - -- 2.10.0
From b6901d1fc194932441f75a50e561bd8c6aa1e45a Mon Sep 17 00:00:00 2001 From: Edi Anderson Lobo <[email protected]> Date: Sat, 15 Oct 2016 00:09:10 -0300 Subject: [PATCH 2/4] Call for sending data. Added an call for function sendDive,for send data for facebook. I changed the way how the widget FacebookConnectWidget is allocated. When the user make loggin in facebook and after loggof and try loggin again get an error. Reported-by: BenjaminF -- Bugtracker #1101. Signed-off-by: Edi Anderson Lobo <[email protected]> --- desktop-widgets/plugins/facebook/facebook_integration.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/desktop-widgets/plugins/facebook/facebook_integration.cpp b/desktop-widgets/plugins/facebook/facebook_integration.cpp index 58d757e..5611d2d 100644 --- a/desktop-widgets/plugins/facebook/facebook_integration.cpp +++ b/desktop-widgets/plugins/facebook/facebook_integration.cpp @@ -1,13 +1,13 @@ #include "facebook_integration.h" #include "facebookconnectwidget.h" +#include <QMessageBox> +#include <QScopedPointer> #include <QDebug> -FacebookPlugin::FacebookPlugin(QObject* parent) : - fbConnectWidget(new FacebookConnectWidget()), - fbUploadDialog(new SocialNetworkDialog()) +FacebookPlugin::FacebookPlugin(QObject* parent) { - Q_UNUSED(parent) + Q_UNUSED(parent) } bool FacebookPlugin::isConnected() @@ -18,7 +18,8 @@ bool FacebookPlugin::isConnected() void FacebookPlugin::requestLogin() { - fbConnectWidget->exec(); + QScopedPointer<FacebookConnectWidget> fbConnectWidget(new FacebookConnectWidget()); + fbConnectWidget->exec(); } void FacebookPlugin::requestLogoff() @@ -39,6 +40,6 @@ QString FacebookPlugin::socialNetworkName() const void FacebookPlugin::requestUpload() { FacebookManager *instance = FacebookManager::instance(); - if (instance->loggedIn()) - fbUploadDialog->exec(); + if ( instance->loggedIn() ) + instance->sendDive(); } -- 2.10.0
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
