From 053c2d0057d9b69463ae9d871a17e1d2283570cd Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Wed, 20 Jun 2012 11:23:36 -0500 Subject: [PATCH 1/2] Parsing token page failed (kde#301240) --- akonadi-google-auth_token.patch | 25 +++++++++++++++++++++++++ akonadi-google.spec | 19 ++++++++++++++----- 2 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 akonadi-google-auth_token.patch diff --git a/akonadi-google-auth_token.patch b/akonadi-google-auth_token.patch new file mode 100644 index 0000000..313f684 --- /dev/null +++ b/akonadi-google-auth_token.patch @@ -0,0 +1,25 @@ +diff -up akonadi-google/libkgoogle/authdialog.cpp.auth_token akonadi-google/libkgoogle/authdialog.cpp +--- akonadi-google/libkgoogle/authdialog.cpp.auth_token 2012-04-27 08:19:17.000000000 -0500 ++++ akonadi-google/libkgoogle/authdialog.cpp 2012-06-20 11:19:59.436455525 -0500 +@@ -102,13 +102,18 @@ void AuthDialog::webviewFinished() + } + + if (url.host() == "accounts.google.com" && url.path() == "/o/oauth2/approval") { +- QWebElement el = m_webiew->page()->mainFrame()->findFirstElement("textarea"); +- if (el.isNull()) { ++ QString title = webview->title(); ++ QString token; ++ ++ if (title.startsWith(QLatin1String("success"), Qt::CaseInsensitive)) { ++ int pos = title.indexOf(QLatin1String("code=")); ++ /* Skip the 'code=' string as well */ ++ token = title.mid (pos + 5); ++ } else { + emitError(KGoogle::AuthError, i18n("Parsing token page failed.")); + return; + } + +- QString token = el.toInnerXml(); + if (token.isEmpty()) { + emitError(KGoogle::AuthError, i18n("Failed to obtain token.")); + return; diff --git a/akonadi-google.spec b/akonadi-google.spec index cd299ef..268a8dc 100644 --- a/akonadi-google.spec +++ b/akonadi-google.spec @@ -1,6 +1,6 @@ Name: akonadi-google Version: 0.3.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Akonadi Resources for accessing Google services License: GPLv3 @@ -16,6 +16,10 @@ URL: http://projects.kde.org/akonadi-google # master Source0: akonadi-google-0.3.1.tar.gz +## backported upstream patches +# https://projects.kde.org/projects/kdereview/libkgoogle/repository/revisions/5c92e2fb5ced528a20fd1d8723fd7a8d7ba686a3 +Patch100: akonadi-google-auth_token.patch + BuildRequires: cmake BuildRequires: qt-devel BuildRequires: kdepimlibs-devel @@ -24,7 +28,7 @@ BuildRequires: akonadi-devel BuildRequires: qjson-devel BuildRequires: libxslt-devel -Requires: libkgoogle = %{version}-%{release} +Requires: libkgoogle%{?_isa} = %{version}-%{release} Requires: %{name}-calendar = %{version}-%{release} Requires: %{name}-contacts = %{version}-%{release} @@ -44,13 +48,13 @@ Group: System Environment/Libraries %package -n libkgoogle-devel Summary: Development files for %{name} Group: Development/Libraries -Requires: libkgoogle = %{version}-%{release} +Requires: libkgoogle%{?_isa} = %{version}-%{release} %description -n libkgoogle-devel Libraries and header files for developing applications that use %{name}. %package calendar Summary: Akonadi resource for Google Calendar and Tasks -Requires: libkgoogle = %{version}-%{release} +Requires: libkgoogle%{?_isa} = %{version}-%{release} Obsoletes: akonadi-google-tasks < 0.3 Provides: akonadi-google-tasks = %{version}-%{release} %description calendar @@ -58,13 +62,15 @@ Provides: akonadi-google-tasks = %{version}-%{release} %package contacts Summary: Akonadi resource for Google Contacts -Requires: libkgoogle = %{version}-%{release} +Requires: libkgoogle%{?_isa} = %{version}-%{release} %description contacts %{summary}. %prep %setup -q -n %{name} +%patch100 -p1 -b .auth_token + %build mkdir -p %{_target_platform} pushd %{_target_platform} @@ -104,6 +110,9 @@ make install/fast DESTDIR=%{buildroot} -C %{_target_platform} %{_datadir}/akonadi/agents/googlecontactsresource.desktop %changelog +* Wed Jun 20 2012 Rex Dieter 0.3.1-2 +- Parsing token page failed (kde#301240) + * Mon Apr 30 2012 Mario Santagiuliana 0.3.1-1 - New version 0.3.1 From 56fd9c057df0870b9574395fb58f84d6321734aa Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Wed, 20 Jun 2012 11:46:05 -0500 Subject: [PATCH 2/2] fix/rebase patch --- akonadi-google-auth_token.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/akonadi-google-auth_token.patch b/akonadi-google-auth_token.patch index 313f684..e6e503a 100644 --- a/akonadi-google-auth_token.patch +++ b/akonadi-google-auth_token.patch @@ -1,13 +1,13 @@ diff -up akonadi-google/libkgoogle/authdialog.cpp.auth_token akonadi-google/libkgoogle/authdialog.cpp --- akonadi-google/libkgoogle/authdialog.cpp.auth_token 2012-04-27 08:19:17.000000000 -0500 -+++ akonadi-google/libkgoogle/authdialog.cpp 2012-06-20 11:19:59.436455525 -0500 ++++ akonadi-google/libkgoogle/authdialog.cpp 2012-06-20 11:44:03.179406253 -0500 @@ -102,13 +102,18 @@ void AuthDialog::webviewFinished() } if (url.host() == "accounts.google.com" && url.path() == "/o/oauth2/approval") { - QWebElement el = m_webiew->page()->mainFrame()->findFirstElement("textarea"); - if (el.isNull()) { -+ QString title = webview->title(); ++ QString title = m_webiew->title(); + QString token; + + if (title.startsWith(QLatin1String("success"), Qt::CaseInsensitive)) {