From cae512fada99e397277b3b71e141cdbb630bbbbf Mon Sep 17 00:00:00 2001 From: Maximiliano Curia Date: Wed, 23 Nov 2016 19:54:36 +0000 Subject: [PATCH 1/1] Import kaccounts-providers_16.08.3.orig.tar.xz [dgit import orig kaccounts-providers_16.08.3.orig.tar.xz] --- .reviewboardrc | 3 + CMakeLists.txt | 37 ++ COPYING | 346 ++++++++++++++++++ Messages.sh | 5 + cmake/modules/COPYING-CMAKE-SCRIPTS | 22 ++ cmake/modules/FindIntltool.cmake | 50 +++ icons/CMakeLists.txt | 4 + plugins/CMakeLists.txt | 1 + plugins/owncloud-ui/CMakeLists.txt | 30 ++ plugins/owncloud-ui/owncloud.cpp | 97 +++++ plugins/owncloud-ui/owncloud.h | 54 +++ .../package/contents/ui/BasicInfo.qml | 110 ++++++ .../package/contents/ui/Services.qml | 44 +++ .../owncloud-ui/package/contents/ui/main.qml | 98 +++++ plugins/owncloud-ui/package/metadata.desktop | 46 +++ plugins/owncloud-ui/qmlhelper.cpp | 242 ++++++++++++ plugins/owncloud-ui/qmlhelper.h | 76 ++++ providers/CMakeLists.txt | 4 + providers/disabled/facebook.provider.in | 27 ++ providers/disabled/identica.provider.in | 26 ++ providers/disabled/owncloud.provider.in | 18 + providers/disabled/runnersid.provider.in | 18 + providers/google.provider.in | 43 +++ providers/owncloud.provider.in | 19 + providers/twitter.provider.in | 24 ++ services/CMakeLists.txt | 4 + .../disabled/facebook-contacts.service.in | 10 + services/disabled/facebook-events.service.in | 10 + services/disabled/facebook-feed.service.in | 10 + services/disabled/facebook-notes.service.in | 10 + .../facebook-notifications.service.in | 10 + services/disabled/google-calendar.service.in | 10 + services/disabled/google-contacts.service.in | 10 + .../disabled/identica-microblog.service.in | 10 + .../disabled/owncloud-calendar.service.in | 16 + .../disabled/owncloud-contacts.service.in | 16 + services/disabled/owncloud-storage.service.in | 16 + services/disabled/runners-calendar.service.in | 16 + services/disabled/runners-contacts.service.in | 16 + services/disabled/runners-music.service.in | 10 + services/disabled/runners-storage.service.in | 16 + .../disabled/twitter-microblog.service.in | 10 + webkit-options/CMakeLists.txt | 5 + webkit-options/accounts.google.com.conf | 8 + webkit-options/api.twitter.com.conf | 2 + webkit-options/identi.ca.conf | 5 + webkit-options/www.facebook.com.conf | 6 + 47 files changed, 1670 insertions(+) create mode 100644 .reviewboardrc create mode 100644 CMakeLists.txt create mode 100644 COPYING create mode 100755 Messages.sh create mode 100644 cmake/modules/COPYING-CMAKE-SCRIPTS create mode 100644 cmake/modules/FindIntltool.cmake create mode 100644 icons/CMakeLists.txt create mode 100644 plugins/CMakeLists.txt create mode 100644 plugins/owncloud-ui/CMakeLists.txt create mode 100644 plugins/owncloud-ui/owncloud.cpp create mode 100644 plugins/owncloud-ui/owncloud.h create mode 100644 plugins/owncloud-ui/package/contents/ui/BasicInfo.qml create mode 100644 plugins/owncloud-ui/package/contents/ui/Services.qml create mode 100644 plugins/owncloud-ui/package/contents/ui/main.qml create mode 100644 plugins/owncloud-ui/package/metadata.desktop create mode 100644 plugins/owncloud-ui/qmlhelper.cpp create mode 100644 plugins/owncloud-ui/qmlhelper.h create mode 100644 providers/CMakeLists.txt create mode 100644 providers/disabled/facebook.provider.in create mode 100644 providers/disabled/identica.provider.in create mode 100644 providers/disabled/owncloud.provider.in create mode 100644 providers/disabled/runnersid.provider.in create mode 100644 providers/google.provider.in create mode 100644 providers/owncloud.provider.in create mode 100644 providers/twitter.provider.in create mode 100644 services/CMakeLists.txt create mode 100644 services/disabled/facebook-contacts.service.in create mode 100644 services/disabled/facebook-events.service.in create mode 100644 services/disabled/facebook-feed.service.in create mode 100644 services/disabled/facebook-notes.service.in create mode 100644 services/disabled/facebook-notifications.service.in create mode 100644 services/disabled/google-calendar.service.in create mode 100644 services/disabled/google-contacts.service.in create mode 100644 services/disabled/identica-microblog.service.in create mode 100644 services/disabled/owncloud-calendar.service.in create mode 100644 services/disabled/owncloud-contacts.service.in create mode 100644 services/disabled/owncloud-storage.service.in create mode 100644 services/disabled/runners-calendar.service.in create mode 100644 services/disabled/runners-contacts.service.in create mode 100644 services/disabled/runners-music.service.in create mode 100644 services/disabled/runners-storage.service.in create mode 100644 services/disabled/twitter-microblog.service.in create mode 100644 webkit-options/CMakeLists.txt create mode 100644 webkit-options/accounts.google.com.conf create mode 100644 webkit-options/api.twitter.com.conf create mode 100644 webkit-options/identi.ca.conf create mode 100644 webkit-options/www.facebook.com.conf diff --git a/.reviewboardrc b/.reviewboardrc new file mode 100644 index 0000000..b4ca1d5 --- /dev/null +++ b/.reviewboardrc @@ -0,0 +1,3 @@ +REPOSITORY = "git://anongit.kde.org/kaccounts-providers" +REVIEWBOARD_URL = "https://git.reviewboard.kde.org" +TARGET_GROUPS = "kde-telepathy" diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..ca1db17 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,37 @@ +project(kde-account-providers) + +cmake_minimum_required(VERSION 2.8.12) + +set(KDE_APPLICATIONS_VERSION_MAJOR "16") +set(KDE_APPLICATIONS_VERSION_MINOR "08") +set(KDE_APPLICATIONS_VERSION_MICRO "3") +set(KACCOUNTS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}") + +set(REQUIRED_QT_VERSION "5.2.0") +set(REQUIRED_KF5_VERSION "5.4.0") + +find_package(ECM 1.0.0 REQUIRED NO_MODULE) +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) + +find_package(Intltool REQUIRED) +find_package(KAccounts REQUIRED) + +find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Core Qml) +find_package(KF5 ${REQUIRED_KF5_VERSION} REQUIRED KIO + I18n + Declarative + Package) + +include(KDEInstallDirs) +include(KDECMakeSettings) +include(FeatureSummary) +include(ECMInstallIcons) +include(KDECompilerSettings NO_POLICY_SCOPE) + +add_subdirectory(icons) +add_subdirectory(services) +add_subdirectory(providers) +add_subdirectory(webkit-options) +add_subdirectory(plugins) + +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..5185fd3 --- /dev/null +++ b/COPYING @@ -0,0 +1,346 @@ +NOTE! The GPL below is copyrighted by the Free Software Foundation, but +the instance of code that it refers to (the kde programs) are copyrighted +by the authors who actually wrote it. + +--------------------------------------------------------------------------- + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + 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 2 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, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/Messages.sh b/Messages.sh new file mode 100755 index 0000000..40963ee --- /dev/null +++ b/Messages.sh @@ -0,0 +1,5 @@ +#! /usr/bin/env bash + +find . -name "*.provider.in" -o -name "*.service.in" -type f | xargs -n1 intltool-extract -l -type="gettext/xml" +$XGETTEXT `find . -name "*.h" -o -name "*.cpp"` -c -kN_ -o $podir/kaccounts-providers.pot +rm -rf ./tmp/ diff --git a/cmake/modules/COPYING-CMAKE-SCRIPTS b/cmake/modules/COPYING-CMAKE-SCRIPTS new file mode 100644 index 0000000..4b41776 --- /dev/null +++ b/cmake/modules/COPYING-CMAKE-SCRIPTS @@ -0,0 +1,22 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/cmake/modules/FindIntltool.cmake b/cmake/modules/FindIntltool.cmake new file mode 100644 index 0000000..5c426a2 --- /dev/null +++ b/cmake/modules/FindIntltool.cmake @@ -0,0 +1,50 @@ +# +# cmake/Intltool.cmake +# Copyright (C) 2013, Valama development team +# +# Valama 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. +# +# Valama 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 . +# +## +find_program(INTLTOOL_EXTRACT_EXECUTABLE intltool-extract) +find_program(INTLTOOL_MERGE_EXECUTABLE intltool-merge) +mark_as_advanced(INTLTOOL_EXTRACT_EXECUTABLE) +mark_as_advanced(INTLTOOL_MERGE_EXECUTABLE) + +if(INTLTOOL_EXTRACT_EXECUTABLE) + execute_process( + COMMAND + ${INTLTOOL_EXTRACT_EXECUTABLE} "--version" + OUTPUT_VARIABLE + intltool_version + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(intltool_version MATCHES "^intltool-extract \\(.*\\) [0-9]") + string(REGEX REPLACE "^intltool-extract \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*" "\\1" INTLTOOL_VERSION_STRING "${intltool_version}") + endif() + unset(intltool_version) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Intltool + REQUIRED_VARS + INTLTOOL_EXTRACT_EXECUTABLE + INTLTOOL_MERGE_EXECUTABLE + VERSION_VAR + INTLTOOL_VERSION_STRING +) + +set(INTLTOOL_OPTIONS_DEFAULT + "--quiet" +) \ No newline at end of file diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt new file mode 100644 index 0000000..21ffc7a --- /dev/null +++ b/icons/CMakeLists.txt @@ -0,0 +1,4 @@ +file(GLOB _icons *.png) + +ecm_install_icons(ICONS ${_icons} + DESTINATION ${ICON_INSTALL_DIR}) \ No newline at end of file diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt new file mode 100644 index 0000000..1bf3906 --- /dev/null +++ b/plugins/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(owncloud-ui) diff --git a/plugins/owncloud-ui/CMakeLists.txt b/plugins/owncloud-ui/CMakeLists.txt new file mode 100644 index 0000000..97b018f --- /dev/null +++ b/plugins/owncloud-ui/CMakeLists.txt @@ -0,0 +1,30 @@ +project (owncloud-ui-plugin) + +include_directories (${CMAKE_CURRENT_BUILD_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} +) + +set (owncloud_plugin_kaccounts_SRCS + owncloud.cpp + qmlhelper.cpp +) + +add_library (owncloud_plugin_kaccounts MODULE + ${owncloud_plugin_kaccounts_SRCS} +) + +target_link_libraries (owncloud_plugin_kaccounts + Qt5::Core + KF5::KIOCore + KF5::I18n + KF5::Declarative + KAccounts + ${ACCOUNTSQT_LIBRARIES} + ${SIGNONQT_LIBRARIES} +) + +# Install: +install (TARGETS owncloud_plugin_kaccounts + DESTINATION ${PLUGIN_INSTALL_DIR}/kaccounts/ui +) +kpackage_install_package(package org.kde.kaccounts.owncloud genericqml) diff --git a/plugins/owncloud-ui/owncloud.cpp b/plugins/owncloud-ui/owncloud.cpp new file mode 100644 index 0000000..4330871 --- /dev/null +++ b/plugins/owncloud-ui/owncloud.cpp @@ -0,0 +1,97 @@ +/************************************************************************************* + * Copyright (C) 2012 by Alejandro Fiestas Olivares * + * Copyright (C) 2015 by Martin Klapetek * + * * + * 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 2 * + * 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, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * + *************************************************************************************/ + +#include "owncloud.h" +#include "qmlhelper.h" + +#include +#include + +#include +#include + +OwnCloudWizard::OwnCloudWizard(QObject *parent) + : KAccountsUiPlugin(parent) +{ +} + +OwnCloudWizard::~OwnCloudWizard() +{ +} + +void OwnCloudWizard::init(KAccountsUiPlugin::UiType type) +{ + if (type == KAccountsUiPlugin::NewAccountDialog) { + + const QString packagePath("org.kde.kaccounts.owncloud"); + + m_object = new KDeclarative::QmlObject(); + m_object->setTranslationDomain(packagePath); + m_object->setInitializationDelayed(true); + m_object->loadPackage(packagePath); + + QmlHelper *helper = new QmlHelper(m_object); + connect(helper, &QmlHelper::wizardFinished, this, &OwnCloudWizard::success); + connect(helper, &QmlHelper::wizardFinished, [=] { + QWindow *window = qobject_cast(m_object->rootObject()); + if (window) { + window->close(); + } + m_object->deleteLater(); + }); + m_object->engine()->rootContext()->setContextProperty("helper", helper); + + m_object->completeInitialization(); + + if (!m_object->package().metadata().isValid()) { + return; + } + + Q_EMIT uiReady(); + } + +} + +void OwnCloudWizard::setProviderName(const QString &providerName) +{ + //TODO: unused? + m_providerName = providerName; +} + +void OwnCloudWizard::showNewAccountDialog() +{ + QWindow *window = qobject_cast(m_object->rootObject()); + if (window) { + window->setTransientParent(transientParent()); + window->show(); + window->requestActivate(); + window->setTitle(m_object->package().metadata().name()); + window->setIcon(QIcon::fromTheme(m_object->package().metadata().iconName())); + } +} + +void OwnCloudWizard::showConfigureAccountDialog(const quint32 accountId) +{ + +} + +QStringList OwnCloudWizard::supportedServicesForConfig() const +{ + return QStringList(); +} diff --git a/plugins/owncloud-ui/owncloud.h b/plugins/owncloud-ui/owncloud.h new file mode 100644 index 0000000..8c7c383 --- /dev/null +++ b/plugins/owncloud-ui/owncloud.h @@ -0,0 +1,54 @@ +/************************************************************************************* + * Copyright (C) 2012 by Alejandro Fiestas Olivares * + * Copyright (C) 2015 by Martin Klapetek * + * * + * 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 2 * + * 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, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * + *************************************************************************************/ + +#ifndef OWNCLOUD_H +#define OWNCLOUD_H + +#include +#include + +#include + +namespace KDeclarative { + class QmlObject; +} + +class OwnCloudWizard : public KAccountsUiPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.kde.kaccounts.UiPlugin") + Q_INTERFACES(KAccountsUiPlugin) + +public: + explicit OwnCloudWizard(QObject *parent = 0); + virtual ~OwnCloudWizard(); + + virtual void init(KAccountsUiPlugin::UiType type) Q_DECL_OVERRIDE; + virtual void setProviderName(const QString &providerName) Q_DECL_OVERRIDE; + virtual void showNewAccountDialog() Q_DECL_OVERRIDE; + virtual void showConfigureAccountDialog(const quint32 accountId) Q_DECL_OVERRIDE; + virtual QStringList supportedServicesForConfig() const Q_DECL_OVERRIDE; + +private: + QString m_providerName; + QHash m_services; + KDeclarative::QmlObject *m_object; +}; + +#endif //OWNCLOUD_H diff --git a/plugins/owncloud-ui/package/contents/ui/BasicInfo.qml b/plugins/owncloud-ui/package/contents/ui/BasicInfo.qml new file mode 100644 index 0000000..e160779 --- /dev/null +++ b/plugins/owncloud-ui/package/contents/ui/BasicInfo.qml @@ -0,0 +1,110 @@ +/* + * Copyright 2015 (C) Martin Klapetek + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 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 Library General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import QtQuick 2.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 +import org.kde.plasma.core 2.0 as PlasmaCore + +ColumnLayout { + id: basicInfoLayout + property bool canContinue: !helper.isWorking && helper.noError && nameText.text.length > 0 && passwordText.text.length > 0 + property bool canRestartTimer: nameText.text.length > 0 && passwordText.text.length > 0 && serverText.text.length > 0 + + Timer { + id: checkServerTimer + interval: 1000 + repeat: false + running: false + + onTriggered: { + helper.checkServer(nameText.text, passwordText.text, serverText.text); + } + } + + TextField { + id: nameText + Layout.fillWidth: true +// clearButtonShown: true + placeholderText: "Username" + + onTextChanged: { + if (basicInfoLayout.canRestartTimer) { + checkServerTimer.restart(); + } + } + } + + TextField { + id: passwordText + Layout.fillWidth: true +// clearButtonShown: true + placeholderText: "Password" + echoMode: TextInput.Password + + onTextChanged: { + if (basicInfoLayout.canRestartTimer) { + checkServerTimer.restart(); + } + } + } + + TextField { + id: serverText + Layout.fillWidth: true +// clearButtonShown: true + placeholderText: "Server" + + onTextChanged: { + if (basicInfoLayout.canRestartTimer) { + checkServerTimer.restart(); + } + } + } + + Label { + id: errorLabel + Layout.fillWidth: true + visible: text.length > 0 && !checkServerTimer.running + text: helper.errorMessage + wrapMode: Text.WordWrap + } + + Item { + Layout.fillWidth: true + Layout.fillHeight: true + + BusyIndicator { + id: busy + width: parent.height > parent.width ? Math.round(parent.width/2) : Math.round(parent.height/2) + height: width + anchors.centerIn: parent + running: helper.isWorking + visible: running + } + + PlasmaCore.IconItem { + width: busy.width + height: width + anchors.centerIn: parent + source: "dialog-ok" + visible: !helper.isWorking && helper.noError && !errorLabel.visible + } + } +} diff --git a/plugins/owncloud-ui/package/contents/ui/Services.qml b/plugins/owncloud-ui/package/contents/ui/Services.qml new file mode 100644 index 0000000..c806cac --- /dev/null +++ b/plugins/owncloud-ui/package/contents/ui/Services.qml @@ -0,0 +1,44 @@ +/* + * Copyright 2015 (C) Martin Klapetek + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 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 Library General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import QtQuick 2.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 + +ColumnLayout { + id: basicInfoLayout + property bool canContinue: true + + //FIXME at some point this should become a list of disabled services + property alias contactsEnabled: contactsService.checked + + Label { + text: i18n("Choose services to enable"); + } + + CheckBox { + id: contactsService + text: i18n("Contacts") + } + + // Just an item padder + Item { + Layout.fillHeight: true + } +} diff --git a/plugins/owncloud-ui/package/contents/ui/main.qml b/plugins/owncloud-ui/package/contents/ui/main.qml new file mode 100644 index 0000000..0ffc71b --- /dev/null +++ b/plugins/owncloud-ui/package/contents/ui/main.qml @@ -0,0 +1,98 @@ +/* + * Copyright 2015 (C) Martin Klapetek + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 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 Library General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import QtQuick 2.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.2 + +ApplicationWindow { + id: kaccountsRoot + objectName: "_root" + + width: 400; height: 250 + + ColumnLayout { + anchors.fill: parent + anchors.margins: units.largeSpacing + + Label { + text: i18n("Add new ownCloud account") + } + + StackView { + id: stack + + Layout.fillHeight: true + Layout.fillWidth: true + + initialItem: BasicInfo { + id: basicInfoPage + objectName: "basicInfoPage" + } + } + + Component { + id: servicesComponent + + Services { + objectName: "servicesPage" + } + } + + RowLayout { + Button { + id: backButton + Layout.fillWidth: true + text: i18n("Back"); + enabled: stack.currentItem.objectName == "servicesPage" + + onClicked: { + if (stack.currentItem.objectName == "servicesPage") { + stack.pop(servicesComponent); + } + } + } + + Button { + id: nextButton + Layout.fillWidth: true + text: i18n("Next") + enabled: basicInfoPage.canContinue //: false + visible: stack.currentItem == basicInfoPage + + onClicked: { + if (stack.currentItem == basicInfoPage) { + stack.push(servicesComponent); + } + } + } + + Button { + id: finishButton + Layout.fillWidth: true + text: i18n("Finish") + visible: stack.currentItem.objectName == "servicesPage" + + onClicked: { + helper.finish(stack.currentItem.contactsEnabled); + } + } + } + } +} diff --git a/plugins/owncloud-ui/package/metadata.desktop b/plugins/owncloud-ui/package/metadata.desktop new file mode 100644 index 0000000..6d4bef5 --- /dev/null +++ b/plugins/owncloud-ui/package/metadata.desktop @@ -0,0 +1,46 @@ +[Desktop Entry] +Name=OwnCloud KAccounts QML plugin +Name[ast]=Complementu QML de KAccounts d'OwnCloud +Name[ca]=Connector OwnCloud en QML per a KAccounts +Name[ca@valencia]=Connector OwnCloud en QML per a KAccounts +Name[cs]=QML modul KAccounts pro OwnCloud +Name[da]=KAccounts-QML-plugin til OwnCloud +Name[de]=KAccounts-QML-Modul für OwnCloud +Name[en_GB]=OwnCloud KAccounts QML plugin +Name[es]=Complemento QML de KAccounts para OwnCloud +Name[et]=KAccountsi OwnCloudi QML-plugin +Name[fi]=OwnCloud KAccounts -QML-liitännäinen +Name[gl]=Complemento QML de KAccounts de OwnCloud +Name[ia]=OwnCloud KAccounts QML plugin +Name[it]=Estensione QML di KAccounts per OwnCloud +Name[ko]=OwnCloud KAccounts QML 플러그인 +Name[nl]=OwnCloud KAccounts QML plug-in +Name[pl]=Wtyczka QML OwnCloud dla KAccounts +Name[pt]='Plugin' em QML do KAccounts para o OwnCloud +Name[pt_BR]=Plugin em QML do KAccounts para o OwnCloud +Name[ru]=Модуль настройки учётных записей OwnCloud +Name[sk]=OwnCloud KAccounts QML plugin +Name[sl]=Vstavek QML za KAccounts za OwnCloud +Name[sr]=КуМЛ прикључак К‑налога за Оунклауд +Name[sr@ijekavian]=КуМЛ прикључак К‑налога за Оунклауд +Name[sr@ijekavianlatin]=QML priključak K‑naloga za ownCloud +Name[sr@latin]=QML priključak K‑naloga za ownCloud +Name[sv]=OwnCloud QML-insticksprogram för konton +Name[uk]=Додаток QML KAccounts OwnCloud +Name[x-test]=xxOwnCloud KAccounts QML pluginxx +Name[zh_CN]=OwnCloud KAccounts QML 插件 + +Encoding=UTF-8 +Type=Service +Icon=applications-internet +X-KDE-PluginInfo-Author=Martin Klapetek +X-KDE-PluginInfo-Email=mklapetek@kde.org +X-KDE-PluginInfo-Name=owncloud_kaccounts_ui +X-KDE-PluginInfo-Version=1.0 +X-KDE-PluginInfo-Website=http://kde.org +X-KDE-PluginInfo-Category=Network +X-KDE-PluginInfo-Depends= +X-KDE-PluginInfo-License=GPL +X-KDE-PluginInfo-EnabledByDefault=true +X-KDE-FormFactors=handset,tablet,mediacenter +X-Plasma-MainScript=ui/main.qml diff --git a/plugins/owncloud-ui/qmlhelper.cpp b/plugins/owncloud-ui/qmlhelper.cpp new file mode 100644 index 0000000..ab5db3a --- /dev/null +++ b/plugins/owncloud-ui/qmlhelper.cpp @@ -0,0 +1,242 @@ +/************************************************************************************* + * Copyright (C) 2015 by Martin Klapetek * + * * + * 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 2 * + * 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, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * + *************************************************************************************/ + +#include "qmlhelper.h" + +#include +#include +#include +#include + +#include +#include +#include + +QmlHelper::QmlHelper(QObject *parent) + : QObject(parent), + m_isWorking(false), + m_noError(false), + m_errorMessage(QString()) +{ +} + +QmlHelper::~QmlHelper() +{ +} + +void QmlHelper::checkServer(const QString &username, const QString &password, const QString &path) +{ + m_errorMessage.clear(); + Q_EMIT errorMessageChanged(); + + m_username = username; + m_password = password; + + QString fixedUrl; + if (!path.startsWith("http://") && !path.startsWith("https://")) { + fixedUrl.append("https://"); + fixedUrl.append(path); + } else { + fixedUrl = path; + } + + m_json.clear(); + + QUrl url(fixedUrl); + url = url.adjusted(QUrl::StripTrailingSlash); + url.setPath(url.path() + '/' + "status.php"); + + if (url.host().isEmpty()) { + return; + } + + checkServer(url); +} + +void QmlHelper::checkServer(const QUrl &url) +{ + qDebug() << "Checking for ownCloud instance at" << url; + setWorking(true); + KIO::TransferJob *job = KIO::get(url, KIO::NoReload, KIO::HideProgressInfo); + job->setUiDelegate(0); + connect(job, SIGNAL(data(KIO::Job*,QByteArray)), SLOT(dataReceived(KIO::Job*,QByteArray))); + connect(job, SIGNAL(finished(KJob*)), this, SLOT(fileChecked(KJob*))); +} + +void QmlHelper::figureOutServer(const QUrl& url) +{ + if (/*url == QLatin1String("/") ||*/ url.isEmpty()) { + serverCheckResult(false); + return; + } + + m_json.clear(); + + qDebug() << "Received url to figure out:" << url; + // This needs 2x up cause first it just removes the status.php + // and only the second call actually moves up + QUrl urlUp = KIO::upUrl(KIO::upUrl(url)); + urlUp.setPath(urlUp.path() + '/' + "status.php"); + + if (urlUp != url) { + checkServer(urlUp.adjusted(QUrl::NormalizePathSegments)); + } else { + serverCheckResult(false); + } +} + +void QmlHelper::dataReceived(KIO::Job *job, const QByteArray &data) +{ + Q_UNUSED(job); + m_json.append(data); +} + +void QmlHelper::fileChecked(KJob* job) +{ + KIO::TransferJob *kJob = qobject_cast(job); + if (kJob->error()) { + qDebug() << job->errorString(); + qDebug() << job->errorText(); + figureOutServer(kJob->url()); + return; + } + + QJsonDocument parser = QJsonDocument::fromJson(m_json); + QJsonObject map = parser.object(); + if (!map.contains("version")) { + figureOutServer(kJob->url()); + qDebug() << "No json"; + return; + } + + m_server = kJob->url().adjusted(QUrl::RemoveFilename).toString(); + qDebug() << "ownCloud appears to be running at the specified URL"; + serverCheckResult(true); +} + +void QmlHelper::setWorking(bool start) +{ + if (start == m_isWorking) { + return; + } + + m_isWorking = start; + Q_EMIT isWorkingChanged(); +} + +void QmlHelper::serverCheckResult(bool result) +{ + m_noError = result; + Q_EMIT noErrorChanged(); + + if (!result) { + m_errorMessage = i18n("Unable to connect to ownCloud at the given server URL. Please check the server URL."); + setWorking(false); + } else { + m_errorMessage.clear(); + + qDebug() << "Server URL ok, checking auth..."; + + m_json.clear(); + + QUrl url(m_server); + + url.setUserName(m_username); + url.setPassword(m_password); + + url = url.adjusted(QUrl::StripTrailingSlash); + url.setPath(url.path() + '/' + "remote.php/webdav"); + // Send a basic PROPFIND command to test access + const QString requestStr = QStringLiteral( + "" + "" + "" + "" + ""); + + KIO::DavJob *job = KIO::davPropFind(url, QDomDocument(requestStr), "1", KIO::HideProgressInfo); + connect(job, SIGNAL(finished(KJob*)), this, SLOT(authCheckResult(KJob*))); + connect(job, SIGNAL(data(KIO::Job*,QByteArray)), SLOT(dataReceived(KIO::Job*,QByteArray))); + + QVariantMap metadata{{"cookies","none"}, {"no-cache",true}}; + + job->setMetaData(metadata); + job->setUiDelegate(0); + job->start(); + } + + Q_EMIT errorMessageChanged(); + +} + +void QmlHelper::authCheckResult(KJob *job) +{ + if (job->error()) { + qDebug() << job->errorString(); + qDebug() << job->errorText(); + } + + KIO::DavJob *kJob = qobject_cast(job); + qDebug() << "Auth job finished, received error page:" << kJob->isErrorPage(); + + if (kJob->isErrorPage()) { + m_errorMessage = i18n("Unable to authenticate using the provided username and password"); + } else { + m_errorMessage.clear(); + } + + Q_EMIT errorMessageChanged(); + + m_noError = !kJob->isErrorPage(); + Q_EMIT noErrorChanged(); + setWorking(false); +} + +bool QmlHelper::isWorking() +{ + return m_isWorking; +} + +bool QmlHelper::noError() +{ + return m_noError; +} + +QString QmlHelper::errorMessage() const +{ + return m_errorMessage; +} + +void QmlHelper::finish(bool contactsEnabled) +{ + QVariantMap data; + data.insert("server", m_server); + + if (!contactsEnabled) { + data.insert("__service/owncloud-contacts", false); + } + + QUrl carddavUrl(m_server); + carddavUrl.setPath(carddavUrl.path() + QString("/remote.php/carddav/addressbooks/%1").arg(m_username)); + + data.insert("carddavUrl", carddavUrl); + + Q_EMIT wizardFinished(m_username, m_password, data); +} + +#include "qmlhelper.moc" diff --git a/plugins/owncloud-ui/qmlhelper.h b/plugins/owncloud-ui/qmlhelper.h new file mode 100644 index 0000000..8c6201c --- /dev/null +++ b/plugins/owncloud-ui/qmlhelper.h @@ -0,0 +1,76 @@ +/************************************************************************************* + * Copyright (C) 2015 by Martin Klapetek * + * * + * 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 2 * + * 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, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * + *************************************************************************************/ + +#ifndef QMLHELPER_H +#define QMLHELPER_H + +#include +#include + +namespace KIO +{ + class Job; +}; +class KJob; + +class QmlHelper : public QObject +{ + Q_OBJECT + Q_PROPERTY(bool isWorking READ isWorking NOTIFY isWorkingChanged) + Q_PROPERTY(bool noError READ noError NOTIFY noErrorChanged) + Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorMessageChanged) + +public: + QmlHelper(QObject *parent = 0); + ~QmlHelper(); + + Q_INVOKABLE void checkServer(const QString &username, const QString &password, const QString &server); + Q_INVOKABLE void finish(bool contactsEnabled); + bool isWorking(); + bool noError(); + QString errorMessage() const; + +Q_SIGNALS: + void isWorkingChanged(); + void noErrorChanged(); + void errorMessageChanged(); + void wizardFinished(const QString &username, const QString &password, const QVariantMap &data); + +private Q_SLOTS: + void fileChecked(KJob *job); + void dataReceived(KIO::Job *job, const QByteArray &data); + void authCheckResult(KJob *job); + +private: + void checkServer(const QUrl &url); + void figureOutServer(const QUrl &url); + void setWorking(bool start); + void serverCheckResult(bool result); + + QByteArray m_json; + QString m_errorMessage; + QString m_server; + QString m_username; + QString m_password; + QStringList m_disabledServices; + bool m_isWorking; + bool m_noError; + +}; + +#endif // QMLHELPER_H diff --git a/providers/CMakeLists.txt b/providers/CMakeLists.txt new file mode 100644 index 0000000..987fb6e --- /dev/null +++ b/providers/CMakeLists.txt @@ -0,0 +1,4 @@ +file(GLOB provider_in_files *.provider.in) +foreach(provider_in_file ${provider_in_files}) + kaccounts_add_provider(${provider_in_file}) +endforeach() diff --git a/providers/disabled/facebook.provider.in b/providers/disabled/facebook.provider.in new file mode 100644 index 0000000..9a104b3 --- /dev/null +++ b/providers/disabled/facebook.provider.in @@ -0,0 +1,27 @@ + + + <_name>Facebook + im-facebook + + <_description>Includes Posts, Notes, Events, Notifications and Chat + kaccounts-providers + .*facebook\.com + + + diff --git a/providers/disabled/identica.provider.in b/providers/disabled/identica.provider.in new file mode 100644 index 0000000..144a57c --- /dev/null +++ b/providers/disabled/identica.provider.in @@ -0,0 +1,26 @@ + + + <_name>identi.ca + laconica_microblog + kaccounts-providers + .*identi\.ca + + + \ No newline at end of file diff --git a/providers/disabled/owncloud.provider.in b/providers/disabled/owncloud.provider.in new file mode 100644 index 0000000..62cf780 --- /dev/null +++ b/providers/disabled/owncloud.provider.in @@ -0,0 +1,18 @@ + + + <_name>ownCloud + owncloud + + <_description>ownCloud account + kaccounts-providers + + + \ No newline at end of file diff --git a/providers/disabled/runnersid.provider.in b/providers/disabled/runnersid.provider.in new file mode 100644 index 0000000..5de22f8 --- /dev/null +++ b/providers/disabled/runnersid.provider.in @@ -0,0 +1,18 @@ + + + + <_name>Runners ID + netrunnerid + kaccounts-providers + .*identi\.ca + + + \ No newline at end of file diff --git a/providers/google.provider.in b/providers/google.provider.in new file mode 100644 index 0000000..1feea31 --- /dev/null +++ b/providers/google.provider.in @@ -0,0 +1,43 @@ + + + <_name>Google + + <_description>Includes GMail, Hangouts, Google Docs, Google+, YouTube and Picasa + im-google + kaccounts-providers + .*google\.com + + + diff --git a/providers/owncloud.provider.in b/providers/owncloud.provider.in new file mode 100644 index 0000000..988fb0c --- /dev/null +++ b/providers/owncloud.provider.in @@ -0,0 +1,19 @@ + + + <_name>ownCloud + owncloud + + <_description>ownCloud account + kaccounts-providers + owncloud_plugin_kaccounts + + + diff --git a/providers/twitter.provider.in b/providers/twitter.provider.in new file mode 100644 index 0000000..58e0922 --- /dev/null +++ b/providers/twitter.provider.in @@ -0,0 +1,24 @@ + + + <_name>Twitter + im-twitter + kaccounts-providers + .*twitter\.com + + + diff --git a/services/CMakeLists.txt b/services/CMakeLists.txt new file mode 100644 index 0000000..93e14fc --- /dev/null +++ b/services/CMakeLists.txt @@ -0,0 +1,4 @@ +file(GLOB service_files_in *.service.in) +foreach(service_file_in ${service_files_in}) + kaccounts_add_service(${service_file_in}) +endforeach() diff --git a/services/disabled/facebook-contacts.service.in b/services/disabled/facebook-contacts.service.in new file mode 100644 index 0000000..7be7818 --- /dev/null +++ b/services/disabled/facebook-contacts.service.in @@ -0,0 +1,10 @@ + + + facebook-contacts + + <_name>Contacts + facebook-contacts + facebook + kaccounts-providers + \ No newline at end of file diff --git a/services/disabled/facebook-events.service.in b/services/disabled/facebook-events.service.in new file mode 100644 index 0000000..ae724e7 --- /dev/null +++ b/services/disabled/facebook-events.service.in @@ -0,0 +1,10 @@ + + + facebook-events + + <_name>Events + facebook-events + facebook + kaccounts-providers + \ No newline at end of file diff --git a/services/disabled/facebook-feed.service.in b/services/disabled/facebook-feed.service.in new file mode 100644 index 0000000..da82ca2 --- /dev/null +++ b/services/disabled/facebook-feed.service.in @@ -0,0 +1,10 @@ + + + facebook-feed + + <_name>Posts Feed + facebook-feed + facebook + kaccounts-providers + \ No newline at end of file diff --git a/services/disabled/facebook-notes.service.in b/services/disabled/facebook-notes.service.in new file mode 100644 index 0000000..ba43deb --- /dev/null +++ b/services/disabled/facebook-notes.service.in @@ -0,0 +1,10 @@ + + + facebook-notes + + <_name>Notes + facebook-notes + facebook + kaccounts-providers + \ No newline at end of file diff --git a/services/disabled/facebook-notifications.service.in b/services/disabled/facebook-notifications.service.in new file mode 100644 index 0000000..d1a672c --- /dev/null +++ b/services/disabled/facebook-notifications.service.in @@ -0,0 +1,10 @@ + + + facebook-notifications + + <_name>Notifications + facebook-notifications + facebook + kaccounts-providers + \ No newline at end of file diff --git a/services/disabled/google-calendar.service.in b/services/disabled/google-calendar.service.in new file mode 100644 index 0000000..a7a3258 --- /dev/null +++ b/services/disabled/google-calendar.service.in @@ -0,0 +1,10 @@ + + + google-calendar + + <_name>Calendars and Tasks + google-calendars + google + kaccounts-providers + diff --git a/services/disabled/google-contacts.service.in b/services/disabled/google-contacts.service.in new file mode 100644 index 0000000..82e4739 --- /dev/null +++ b/services/disabled/google-contacts.service.in @@ -0,0 +1,10 @@ + + + google-contacts + + <_name>Contacts + google-contacts + google + kaccounts-providers + \ No newline at end of file diff --git a/services/disabled/identica-microblog.service.in b/services/disabled/identica-microblog.service.in new file mode 100644 index 0000000..e703e7a --- /dev/null +++ b/services/disabled/identica-microblog.service.in @@ -0,0 +1,10 @@ + + + twitter-microblog + + <_name>identi.ca + identica + identica + kaccounts-providers + \ No newline at end of file diff --git a/services/disabled/owncloud-calendar.service.in b/services/disabled/owncloud-calendar.service.in new file mode 100644 index 0000000..a41c12d --- /dev/null +++ b/services/disabled/owncloud-calendar.service.in @@ -0,0 +1,16 @@ + + + dav-calendar + + <_name>Calendar + owncloud-calendar + owncloud + kaccounts-providers + + + \ No newline at end of file diff --git a/services/disabled/owncloud-contacts.service.in b/services/disabled/owncloud-contacts.service.in new file mode 100644 index 0000000..c15ab45 --- /dev/null +++ b/services/disabled/owncloud-contacts.service.in @@ -0,0 +1,16 @@ + + + dav-contacts + + <_name>Contacts + owncloud-contacts + owncloud + kaccounts-providers + + + \ No newline at end of file diff --git a/services/disabled/owncloud-storage.service.in b/services/disabled/owncloud-storage.service.in new file mode 100644 index 0000000..81ab18c --- /dev/null +++ b/services/disabled/owncloud-storage.service.in @@ -0,0 +1,16 @@ + + + dav-storage + + <_name>Storage + owncloud-storage + owncloud + kaccounts-providers + + + \ No newline at end of file diff --git a/services/disabled/runners-calendar.service.in b/services/disabled/runners-calendar.service.in new file mode 100644 index 0000000..5013007 --- /dev/null +++ b/services/disabled/runners-calendar.service.in @@ -0,0 +1,16 @@ + + + dav-calendar + + <_name>Calendar + runnersid-calendar + runnersid + kaccounts-providers + + + \ No newline at end of file diff --git a/services/disabled/runners-contacts.service.in b/services/disabled/runners-contacts.service.in new file mode 100644 index 0000000..f3fce3b --- /dev/null +++ b/services/disabled/runners-contacts.service.in @@ -0,0 +1,16 @@ + + + dav-contacts + + <_name>Contacts + runnersid-contacts + runnersid + kaccounts-providers + + + \ No newline at end of file diff --git a/services/disabled/runners-music.service.in b/services/disabled/runners-music.service.in new file mode 100644 index 0000000..b78ac9c --- /dev/null +++ b/services/disabled/runners-music.service.in @@ -0,0 +1,10 @@ + + + music + + <_name>Music + runnersid-music + runnersid + kaccounts-providers + \ No newline at end of file diff --git a/services/disabled/runners-storage.service.in b/services/disabled/runners-storage.service.in new file mode 100644 index 0000000..4963dd7 --- /dev/null +++ b/services/disabled/runners-storage.service.in @@ -0,0 +1,16 @@ + + + dav-storage + + <_name>Storage + runnersid-storage + runnersid + kaccounts-providers + + + \ No newline at end of file diff --git a/services/disabled/twitter-microblog.service.in b/services/disabled/twitter-microblog.service.in new file mode 100644 index 0000000..97ab4f0 --- /dev/null +++ b/services/disabled/twitter-microblog.service.in @@ -0,0 +1,10 @@ + + + twitter-microblog + + <_name>Twitter + twitter + twitter + kaccounts-providers + \ No newline at end of file diff --git a/webkit-options/CMakeLists.txt b/webkit-options/CMakeLists.txt new file mode 100644 index 0000000..7fe2e39 --- /dev/null +++ b/webkit-options/CMakeLists.txt @@ -0,0 +1,5 @@ +set(WEBKIT_CONFIG_DESTINATION ${KDE_INSTALL_FULL_SYSCONFDIR}/signon-ui/webkit-options.d/) +install(FILES www.facebook.com.conf DESTINATION ${WEBKIT_CONFIG_DESTINATION}) +install(FILES accounts.google.com.conf DESTINATION ${WEBKIT_CONFIG_DESTINATION}) +install(FILES api.twitter.com.conf DESTINATION ${WEBKIT_CONFIG_DESTINATION}) +install(FILES identi.ca.conf DESTINATION ${WEBKIT_CONFIG_DESTINATION}) diff --git a/webkit-options/accounts.google.com.conf b/webkit-options/accounts.google.com.conf new file mode 100644 index 0000000..07a90db --- /dev/null +++ b/webkit-options/accounts.google.com.conf @@ -0,0 +1,8 @@ +ViewportWidth = 480 +ViewportHeight = 420 +UsernameField = input[name="Email"] +PasswordField = input[name="Passwd"] +# Accept all https URLs, and add as exceptions those http only +# URLs which are used in some countries. +# See https://bugs.launchpad.net/bugs/1074733 +AllowedUrls = (https://.*|http://[^/]*google\\.[^.]+/accounts/.*) \ No newline at end of file diff --git a/webkit-options/api.twitter.com.conf b/webkit-options/api.twitter.com.conf new file mode 100644 index 0000000..12aea75 --- /dev/null +++ b/webkit-options/api.twitter.com.conf @@ -0,0 +1,2 @@ +UsernameField = input[id="username_or_email"] +PasswordField = input[id="password"] \ No newline at end of file diff --git a/webkit-options/identi.ca.conf b/webkit-options/identi.ca.conf new file mode 100644 index 0000000..870fc00 --- /dev/null +++ b/webkit-options/identi.ca.conf @@ -0,0 +1,5 @@ +UsernameField = input[name="nickname"] +PasswordField = input[name="password"] +# Force mobile version, so that layout does not scroll horizonally +# https://bugs.launchpad.net/1051596 +UserAgent = Mozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3 \ No newline at end of file diff --git a/webkit-options/www.facebook.com.conf b/webkit-options/www.facebook.com.conf new file mode 100644 index 0000000..fc4fa67 --- /dev/null +++ b/webkit-options/www.facebook.com.conf @@ -0,0 +1,6 @@ +ViewportWidth = 420 +ViewportHeight = 320 +UsernameField = input[name="email"] +PasswordField = input[name="pass"] +#ZoomFactor = 2 +#PreferredWidth = 420 \ No newline at end of file -- 2.30.2