From b363d2579af0a11b77e698aed2e1021c2233b644 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 26 Jan 2013 13:17:50 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- kresources/scalix/CMakeLists.txt | 17 - kresources/scalix/Makefile.am | 4 - kresources/scalix/README | 9 - kresources/scalix/kabc/CMakeLists.txt | 53 -- kresources/scalix/kabc/Makefile.am | 27 - kresources/scalix/kabc/contact.cpp | 377 --------- kresources/scalix/kabc/contact.h | 37 - kresources/scalix/kabc/resourcescalix.cpp | 628 -------------- kresources/scalix/kabc/resourcescalix.h | 171 ---- kresources/scalix/kabc/resourcescalix_plugin.cpp | 53 -- kresources/scalix/kabc/scalix.desktop | 30 - kresources/scalix/kcal/CMakeLists.txt | 53 -- kresources/scalix/kcal/Makefile.am | 27 - kresources/scalix/kcal/resourcescalix.cpp | 903 --------------------- kresources/scalix/kcal/resourcescalix.h | 225 ----- kresources/scalix/kcal/resourcescalix_plugin.cpp | 50 -- kresources/scalix/kcal/scalix.desktop | 31 - kresources/scalix/kioslave/CMakeLists.txt | 37 - kresources/scalix/kioslave/Makefile.am | 17 - kresources/scalix/kioslave/scalix.cpp | 225 ----- kresources/scalix/kioslave/scalix.h | 52 -- kresources/scalix/kioslave/scalix.protocol | 8 - kresources/scalix/kioslave/scalixs.protocol | 8 - kresources/scalix/knotes/CMakeLists.txt | 56 -- kresources/scalix/knotes/Makefile.am | 28 - kresources/scalix/knotes/resourcescalix.cpp | 425 ---------- kresources/scalix/knotes/resourcescalix.h | 128 --- kresources/scalix/knotes/resourcescalix_plugin.cpp | 50 -- kresources/scalix/knotes/scalix.desktop | 30 - kresources/scalix/scalixadmin/CMakeLists.txt | 33 - kresources/scalix/scalixadmin/Makefile.am | 15 - kresources/scalix/scalixadmin/delegatedialog.cpp | 105 --- kresources/scalix/scalixadmin/delegatedialog.h | 54 -- kresources/scalix/scalixadmin/delegatemanager.cpp | 49 -- kresources/scalix/scalixadmin/delegatemanager.h | 50 -- kresources/scalix/scalixadmin/delegatepage.cpp | 170 ---- kresources/scalix/scalixadmin/delegatepage.h | 61 -- kresources/scalix/scalixadmin/delegateview.cpp | 74 -- kresources/scalix/scalixadmin/delegateview.h | 49 -- kresources/scalix/scalixadmin/jobs.cpp | 306 ------- kresources/scalix/scalixadmin/jobs.h | 205 ----- kresources/scalix/scalixadmin/ldapdialog.cpp | 43 - kresources/scalix/scalixadmin/ldapdialog.h | 39 - kresources/scalix/scalixadmin/ldapview.cpp | 99 --- kresources/scalix/scalixadmin/ldapview.h | 52 -- kresources/scalix/scalixadmin/main.cpp | 53 -- kresources/scalix/scalixadmin/mainwindow.cpp | 59 -- kresources/scalix/scalixadmin/mainwindow.h | 32 - kresources/scalix/scalixadmin/otherusermanager.cpp | 51 -- kresources/scalix/scalixadmin/otherusermanager.h | 48 -- kresources/scalix/scalixadmin/otheruserpage.cpp | 173 ---- kresources/scalix/scalixadmin/otheruserpage.h | 61 -- kresources/scalix/scalixadmin/otheruserview.cpp | 71 -- kresources/scalix/scalixadmin/otheruserview.h | 45 - kresources/scalix/scalixadmin/outofofficepage.cpp | 125 --- kresources/scalix/scalixadmin/outofofficepage.h | 58 -- kresources/scalix/scalixadmin/passwordpage.cpp | 190 ----- kresources/scalix/scalixadmin/passwordpage.h | 56 -- kresources/scalix/scalixadmin/settings.cpp | 136 ---- kresources/scalix/scalixadmin/settings.h | 56 -- kresources/scalix/shared/CMakeLists.txt | 31 - kresources/scalix/shared/Makefile.am | 17 - kresources/scalix/shared/kmailconnection.cpp | 281 ------- kresources/scalix/shared/kmailconnection.h | 118 --- kresources/scalix/shared/resourcescalixbase.cpp | 179 ---- kresources/scalix/shared/resourcescalixbase.h | 180 ---- kresources/scalix/shared/scalixbase.cpp | 446 ---------- kresources/scalix/shared/scalixbase.h | 176 ---- kresources/scalix/shared/subresource.cpp | 116 --- kresources/scalix/shared/subresource.h | 110 --- kresources/scalix/uninstall.desktop | 2 - 71 files changed, 8033 deletions(-) delete mode 100644 kresources/scalix/CMakeLists.txt delete mode 100644 kresources/scalix/Makefile.am delete mode 100644 kresources/scalix/README delete mode 100644 kresources/scalix/kabc/CMakeLists.txt delete mode 100644 kresources/scalix/kabc/Makefile.am delete mode 100644 kresources/scalix/kabc/contact.cpp delete mode 100644 kresources/scalix/kabc/contact.h delete mode 100644 kresources/scalix/kabc/resourcescalix.cpp delete mode 100644 kresources/scalix/kabc/resourcescalix.h delete mode 100644 kresources/scalix/kabc/resourcescalix_plugin.cpp delete mode 100644 kresources/scalix/kabc/scalix.desktop delete mode 100644 kresources/scalix/kcal/CMakeLists.txt delete mode 100644 kresources/scalix/kcal/Makefile.am delete mode 100644 kresources/scalix/kcal/resourcescalix.cpp delete mode 100644 kresources/scalix/kcal/resourcescalix.h delete mode 100644 kresources/scalix/kcal/resourcescalix_plugin.cpp delete mode 100644 kresources/scalix/kcal/scalix.desktop delete mode 100644 kresources/scalix/kioslave/CMakeLists.txt delete mode 100644 kresources/scalix/kioslave/Makefile.am delete mode 100644 kresources/scalix/kioslave/scalix.cpp delete mode 100644 kresources/scalix/kioslave/scalix.h delete mode 100644 kresources/scalix/kioslave/scalix.protocol delete mode 100644 kresources/scalix/kioslave/scalixs.protocol delete mode 100644 kresources/scalix/knotes/CMakeLists.txt delete mode 100644 kresources/scalix/knotes/Makefile.am delete mode 100644 kresources/scalix/knotes/resourcescalix.cpp delete mode 100644 kresources/scalix/knotes/resourcescalix.h delete mode 100644 kresources/scalix/knotes/resourcescalix_plugin.cpp delete mode 100644 kresources/scalix/knotes/scalix.desktop delete mode 100644 kresources/scalix/scalixadmin/CMakeLists.txt delete mode 100644 kresources/scalix/scalixadmin/Makefile.am delete mode 100644 kresources/scalix/scalixadmin/delegatedialog.cpp delete mode 100644 kresources/scalix/scalixadmin/delegatedialog.h delete mode 100644 kresources/scalix/scalixadmin/delegatemanager.cpp delete mode 100644 kresources/scalix/scalixadmin/delegatemanager.h delete mode 100644 kresources/scalix/scalixadmin/delegatepage.cpp delete mode 100644 kresources/scalix/scalixadmin/delegatepage.h delete mode 100644 kresources/scalix/scalixadmin/delegateview.cpp delete mode 100644 kresources/scalix/scalixadmin/delegateview.h delete mode 100644 kresources/scalix/scalixadmin/jobs.cpp delete mode 100644 kresources/scalix/scalixadmin/jobs.h delete mode 100644 kresources/scalix/scalixadmin/ldapdialog.cpp delete mode 100644 kresources/scalix/scalixadmin/ldapdialog.h delete mode 100644 kresources/scalix/scalixadmin/ldapview.cpp delete mode 100644 kresources/scalix/scalixadmin/ldapview.h delete mode 100644 kresources/scalix/scalixadmin/main.cpp delete mode 100644 kresources/scalix/scalixadmin/mainwindow.cpp delete mode 100644 kresources/scalix/scalixadmin/mainwindow.h delete mode 100644 kresources/scalix/scalixadmin/otherusermanager.cpp delete mode 100644 kresources/scalix/scalixadmin/otherusermanager.h delete mode 100644 kresources/scalix/scalixadmin/otheruserpage.cpp delete mode 100644 kresources/scalix/scalixadmin/otheruserpage.h delete mode 100644 kresources/scalix/scalixadmin/otheruserview.cpp delete mode 100644 kresources/scalix/scalixadmin/otheruserview.h delete mode 100644 kresources/scalix/scalixadmin/outofofficepage.cpp delete mode 100644 kresources/scalix/scalixadmin/outofofficepage.h delete mode 100644 kresources/scalix/scalixadmin/passwordpage.cpp delete mode 100644 kresources/scalix/scalixadmin/passwordpage.h delete mode 100644 kresources/scalix/scalixadmin/settings.cpp delete mode 100644 kresources/scalix/scalixadmin/settings.h delete mode 100644 kresources/scalix/shared/CMakeLists.txt delete mode 100644 kresources/scalix/shared/Makefile.am delete mode 100644 kresources/scalix/shared/kmailconnection.cpp delete mode 100644 kresources/scalix/shared/kmailconnection.h delete mode 100644 kresources/scalix/shared/resourcescalixbase.cpp delete mode 100644 kresources/scalix/shared/resourcescalixbase.h delete mode 100644 kresources/scalix/shared/scalixbase.cpp delete mode 100644 kresources/scalix/shared/scalixbase.h delete mode 100644 kresources/scalix/shared/subresource.cpp delete mode 100644 kresources/scalix/shared/subresource.h delete mode 100644 kresources/scalix/uninstall.desktop (limited to 'kresources/scalix') diff --git a/kresources/scalix/CMakeLists.txt b/kresources/scalix/CMakeLists.txt deleted file mode 100644 index ca7fc5237..000000000 --- a/kresources/scalix/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -add_subdirectory( shared ) -add_subdirectory( kabc ) -add_subdirectory( kcal ) -add_subdirectory( kioslave ) -add_subdirectory( knotes ) -add_subdirectory( scalixadmin ) diff --git a/kresources/scalix/Makefile.am b/kresources/scalix/Makefile.am deleted file mode 100644 index 1a58c7ec9..000000000 --- a/kresources/scalix/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -SUBDIRS = shared kabc kcal kioslave knotes scalixadmin - -messages: rc.cpp - $(XGETTEXT) shared/*.cpp kabc/*.cpp kcal/*.cpp knotes/*.cpp -o $(podir)/kres_scalix.pot diff --git a/kresources/scalix/README b/kresources/scalix/README deleted file mode 100644 index 34a00e9ad..000000000 --- a/kresources/scalix/README +++ /dev/null @@ -1,9 +0,0 @@ -The Scalix Resource is based on the code of the Kolab resource as both -groupware servers use a similar storage concept (storing pim items as -email attachments on an IMAP server). - -However the Scalix Resource has several modifications, e.g. the XML storage -type was removed and freebusy handling is done via a separated KIO slave. - -If you have any problems, questions or suggestions contact me under - Tobias Koenig diff --git a/kresources/scalix/kabc/CMakeLists.txt b/kresources/scalix/kabc/CMakeLists.txt deleted file mode 100644 index c900f92b2..000000000 --- a/kresources/scalix/kabc/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_SOURCE_DIR} - ${CMAKE_SOURCE_DIR}/libtdepim - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -##### other data ################################ - -install( - FILES scalix.desktop - DESTINATION ${SERVICES_INSTALL_DIR}/kresources/kabc ) - -install( - FILES ../uninstall.desktop - RENAME imap.desktop - DESTINATION ${SERVICES_INSTALL_DIR}/kresources/kabc ) - - -##### kabc_scalix (module) ###################### - -tde_add_kpart( kabc_scalix AUTOMOC - SOURCES resourcescalix_plugin.cpp - LINK kabcscalix-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) - - -##### kabcscalix (shared) ####################### - -tde_add_library( kabcscalix SHARED AUTOMOC - SOURCES resourcescalix.cpp contact.cpp - VERSION 0.0.0 - LINK resourcescalixshared-static kgroupwarebase-shared - DESTINATION ${LIB_INSTALL_DIR} -) diff --git a/kresources/scalix/kabc/Makefile.am b/kresources/scalix/kabc/Makefile.am deleted file mode 100644 index a9fbf2021..000000000 --- a/kresources/scalix/kabc/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -METASOURCES = AUTO - -INCLUDES = -I$(top_srcdir)/kresources/scalix/shared -I$(top_srcdir) $(all_includes) - -# The scalix wizard links to this library too -lib_LTLIBRARIES = libkabcscalix.la - -libkabcscalix_la_SOURCES = resourcescalix.cpp contact.cpp -libkabcscalix_la_LDFLAGS = $(all_libraries) -no-undefined -libkabcscalix_la_LIBADD = \ - $(top_builddir)/kresources/scalix/shared/libresourcescalixshared.la \ - -lkresources -lkabc - -kde_module_LTLIBRARIES = kabc_scalix.la - -noinst_HEADERS = resourcescalix.h - -kabc_scalix_la_SOURCES = resourcescalix_plugin.cpp -kabc_scalix_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -no-undefined -kabc_scalix_la_LIBADD = libkabcscalix.la - -servicedir = $(kde_servicesdir)/kresources/kabc -service_DATA = scalix.desktop - -install-data-local: $(srcdir)/../uninstall.desktop - $(mkinstalldirs) $(DESTDIR)$(servicedir) - $(INSTALL_DATA) $(srcdir)/../uninstall.desktop $(DESTDIR)$(servicedir)/imap.desktop diff --git a/kresources/scalix/kabc/contact.cpp b/kresources/scalix/kabc/contact.cpp deleted file mode 100644 index 457a34e77..000000000 --- a/kresources/scalix/kabc/contact.cpp +++ /dev/null @@ -1,377 +0,0 @@ -/* - * This file is part of the scalix resource. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 - -#include -#include - -#include "contact.h" - -using namespace Scalix; - -static TQMap *s_distListMap = 0; -static KStaticDeleter< TQMap > sd; - -static TQString custom( const TQString &name, const KABC::Addressee &addr, const TQString &defaultValue = TQString() ) -{ - const TQString value = addr.custom( "Scalix", name ); - if ( value.isEmpty() ) - return defaultValue; - else - return value; -} - -static void setCustom( const TQString &name, const TQString &value, KABC::Addressee &addr ) -{ - addr.insertCustom( "Scalix", name, value ); -} - -TQString Contact::toXml( const KABC::Addressee &addr ) -{ - /** - * Handle distribution lists. - */ - if ( KPIM::DistributionList::isDistributionList( addr ) ) { - if ( s_distListMap ) - return (*s_distListMap)[ addr.uid() ]; - else - return TQString(); - } - - /** - * Handle normal contacts. - */ - TQString xml; - xml += "\n"; - xml += "\n"; - - xml += "" + addr.uid() + "\n"; - xml += "" + custom( "sensitivity", addr, "0" ) + "\n"; - - xml += "IPM.Contact\n"; - xml += "" + custom( "is_recurring", addr, "false" ) + "\n"; - xml += "" + custom( "reminder_set", addr, "false" ) + "\n"; - xml += "" + custom( "send_rich_info", addr, "false" ) + "\n"; - xml += "" + addr.formattedName() + "\n"; - xml += "" + addr.revision().toString( Qt::ISODate ) + "\n"; - - xml += "" + addr.prefix() + "\n"; - xml += "" + addr.givenName() + "\n"; - xml += "" + addr.additionalName() + "\n"; - xml += "" + addr.familyName() + "\n"; - xml += "" + addr.suffix() + "\n"; - xml += "" + addr.assembledName() + "\n"; - xml += "" + addr.formattedName() + "\n"; - xml += "" + addr.nickName() + "\n"; - - xml += "" + addr.url().url() + "\n"; - xml += "" + addr.organization() + "\n"; - xml += "" + addr.title() + "\n"; - - TQStringList emails = addr.emails(); - for ( uint i = 0; i < 3; ++i ) { - TQString type, address, comment, display; - - if ( i < emails.count() ) { - type = "SMTP"; - address = emails[ i ]; - - /** - * If the contact was created by kontact use the email address as - * display name and the formatted name as comment, otherwise we use - * the values from the server. - */ - if ( custom( "comes_from_scalix", addr ) != "true" ) { - comment = addr.formattedName(); - display = emails[ i ]; - } else { - comment = custom( TQString( "email%1_address_with_comment" ).arg( i + 1 ), addr ); - display = custom( TQString( "email%1_display_name" ).arg( i + 1 ), addr ); - } - } - - xml += TQString( "" ).arg( i + 1 ) + type + - TQString( "" ).arg( i + 1 ) +"\n"; - xml += TQString( "" ).arg( i + 1 ) + address + - TQString( "" ).arg( i + 1 ) +"\n"; - xml += TQString( "" ).arg( i + 1 ) + comment + - TQString( "" ).arg( i + 1 ) + "\n"; - xml += TQString( "" ).arg( i + 1 ) + display + - TQString( "" ).arg( i + 1 ) + "\n"; - } - - KABC::PhoneNumber phone = addr.phoneNumber( KABC::PhoneNumber::Home ); - xml += "" + phone.number() + "\n"; - - phone = addr.phoneNumber( KABC::PhoneNumber::Work ); - xml += "" + phone.number() + "\n"; - - phone = addr.phoneNumber( KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax ); - xml += "" + phone.number() + "\n"; - - phone = addr.phoneNumber( KABC::PhoneNumber::Cell ); - xml += "" + phone.number() + "\n"; - - const KABC::Address workAddress = addr.address( KABC::Address::Work ); - xml += "" + workAddress.street() + "\n"; - xml += "" + workAddress.postalCode() + "\n"; - xml += "" + workAddress.locality() + "\n"; - xml += "" + workAddress.region() + "\n"; - xml += "" + workAddress.country() + "\n"; - - const KABC::Address homeAddress = addr.address( KABC::Address::Home ); - xml += "" + homeAddress.street() + "\n"; - xml += "" + homeAddress.postalCode() + "\n"; - xml += "" + homeAddress.locality() + "\n"; - xml += "" + homeAddress.region() + "\n"; - xml += "" + homeAddress.country() + "\n"; - - const KABC::Address otherAddress = addr.address( KABC::Address::Dom ); - xml += "" + otherAddress.street() + "\n"; - xml += "" + otherAddress.postalCode() + "\n"; - xml += "" + otherAddress.locality() + "\n"; - xml += "" + otherAddress.region() + "\n"; - xml += "" + otherAddress.country() + "\n"; - - if ( homeAddress.type() & KABC::Address::Pref ) - xml += "1\n"; - else if ( workAddress.type() & KABC::Address::Pref ) - xml += "2\n"; - else if ( otherAddress.type() & KABC::Address::Pref ) - xml += "3\n"; - - xml += "" + addr.custom( "KADDRESSBOOK", "X-IMAddress" ) + "\n"; - xml += "" + addr.custom( "KADDRESSBOOK", "X-ManagersName" ) + "\n"; - xml += "" + addr.custom( "KADDRESSBOOK", "X-Department" ) + "\n"; - xml += "" + addr.custom( "KADDRESSBOOK", "X-AssistantsName" ) + "\n"; - xml += "" + addr.custom( "KADDRESSBOOK", "X-Profession" ) + "\n"; - xml += "" + addr.custom( "KADDRESSBOOK", "X-Office" ) + "\n"; - xml += "" + addr.custom( "KADDRESSBOOK", "X-SpousesName" ) + "\n"; - - xml += "" + addr.birthday().toString( Qt::ISODate ) + "\n"; - xml += "" + addr.custom( "KADDRESSBOOK", "X-Anniversary" ) + "\n"; - - xml += "" + custom( "mapi_charset", addr, "UTF8" ) + ""; - - xml += "\n"; - - return xml; -} - -KABC::Addressee Contact::fromXml( const TQString &xml ) -{ - TQDomDocument document; - - TQString errorMsg; - int errorLine, errorColumn; - if ( !document.setContent( xml, true, &errorMsg, &errorLine, &errorColumn ) ) { - tqDebug( "Error parsing XML in Scalix::Contact::fromXml: %s (%d,%d)", errorMsg.latin1(), errorLine, errorColumn ); - return KABC::Addressee(); - } - - TQDomElement contactElement = document.documentElement(); - if ( contactElement.tagName() != "contact" ) { - if ( contactElement.tagName() == "distlist" ) { - const TQDomNodeList names = contactElement.elementsByTagName( "display_name" ); - const TQString listName = ( names.count() == 1 ? names.item( 0 ).toElement().text() : "Scalix Dummy List" ); - - /** - * As we can't provide distribution list functionality we store the entry - * here and return it on save. - */ - KPIM::DistributionList list; - list.setName( listName ); - - if ( !s_distListMap ) - sd.setObject( s_distListMap, new TQMap() ); - - s_distListMap->insert( list.uid(), xml ); - - return list; - } else { - tqDebug( "Error interpreting XML in Scalix::Contact::fromXml: no 'contact' or 'distlist' tag found" ); - return KABC::Addressee(); - } - } - - TQString emails[ 3 ]; - KABC::Address homeAddress( KABC::Address::Home ); - KABC::Address workAddress( KABC::Address::Work ); - KABC::Address otherAddress( KABC::Address::Dom ); - - KABC::Addressee addr; - setCustom( "comes_from_scalix", "true", addr ); - - TQDomNode node = contactElement.firstChild(); - while ( !node.isNull() ) { - TQDomElement element = node.toElement(); - if ( !element.isNull() ) { - if ( element.tagName() == "direct_ref" ) - addr.setUid( element.text() ); - else if ( element.tagName() == "sensitivity" ) - setCustom( "sensitivity", element.text(), addr ); - else if ( element.tagName() == "is_recurring" ) - setCustom( "is_recurring", element.text(), addr ); - else if ( element.tagName() == "reminder_set" ) - setCustom( "reminder_set", element.text(), addr ); - else if ( element.tagName() == "send_rich_info" ) - setCustom( "send_rich_info", element.text(), addr ); - else if ( element.tagName() == "last_modification_time" ) - addr.setRevision( TQDateTime::fromString( element.text(), Qt::ISODate ) ); - - // name - else if ( element.tagName() == "display_name_prefix" ) - addr.setPrefix( element.text() ); - else if ( element.tagName() == "first_name" ) - addr.setGivenName( element.text() ); - else if ( element.tagName() == "middle_name" ) - addr.setAdditionalName( element.text() ); - else if ( element.tagName() == "last_name" ) - addr.setFamilyName( element.text() ); - else if ( element.tagName() == "suffix" ) - addr.setSuffix( element.text() ); - else if ( element.tagName() == "file_as" ) - addr.setFormattedName( element.text() ); - else if ( element.tagName() == "nickname" ) - addr.setNickName( element.text() ); - - // job - else if ( element.tagName() == "web_page_address" ) - addr.setUrl( element.text() ); - else if ( element.tagName() == "company_name" ) - addr.setOrganization( element.text() ); - else if ( element.tagName() == "job_title" ) - addr.setTitle( element.text() ); - - // emails - else if ( element.tagName().startsWith( "email" ) ) { - if ( element.tagName() == "email1_address" ) - emails[ 0 ] = element.text(); - else if ( element.tagName() == "email2_address" ) - emails[ 1 ] = element.text(); - else if ( element.tagName() == "email3_address" ) - emails[ 2 ] = element.text(); - else - setCustom( element.tagName(), element.text(), addr ); - } - - // phone numbers - else if ( element.tagName() == "home_phone_number" ) - addr.insertPhoneNumber( KABC::PhoneNumber( element.text(), KABC::PhoneNumber::Home ) ); - else if ( element.tagName() == "work_phone_number" ) - addr.insertPhoneNumber( KABC::PhoneNumber( element.text(), KABC::PhoneNumber::Work ) ); - else if ( element.tagName() == "work_fax_number" ) - addr.insertPhoneNumber( KABC::PhoneNumber( element.text(), KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax ) ); - else if ( element.tagName() == "mobile_phone_number" ) - addr.insertPhoneNumber( KABC::PhoneNumber( element.text(), KABC::PhoneNumber::Cell ) ); - - // address (work) - else if ( element.tagName() == "work_address_street" ) - workAddress.setStreet( element.text() ); - else if ( element.tagName() == "work_address_zip" ) - workAddress.setPostalCode( element.text() ); - else if ( element.tagName() == "work_address_city" ) - workAddress.setLocality( element.text() ); - else if ( element.tagName() == "work_address_state" ) - workAddress.setRegion( element.text() ); - else if ( element.tagName() == "work_address_country" ) - workAddress.setCountry( element.text() ); - - // address (home) - else if ( element.tagName() == "home_address_street" ) - homeAddress.setStreet( element.text() ); - else if ( element.tagName() == "home_address_zip" ) - homeAddress.setPostalCode( element.text() ); - else if ( element.tagName() == "home_address_city" ) - homeAddress.setLocality( element.text() ); - else if ( element.tagName() == "home_address_state" ) - homeAddress.setRegion( element.text() ); - else if ( element.tagName() == "home_address_country" ) - homeAddress.setCountry( element.text() ); - - // address (other) - else if ( element.tagName() == "other_address_street" ) - otherAddress.setStreet( element.text() ); - else if ( element.tagName() == "other_address_zip" ) - otherAddress.setPostalCode( element.text() ); - else if ( element.tagName() == "other_address_city" ) - otherAddress.setLocality( element.text() ); - else if ( element.tagName() == "other_address_state" ) - otherAddress.setRegion( element.text() ); - else if ( element.tagName() == "other_address_country" ) - otherAddress.setCountry( element.text() ); - - else if ( element.tagName() == "selected_mailing_address" ) - switch ( element.text().toInt() ) { - case 1: - homeAddress.setType( homeAddress.type() | KABC::Address::Pref ); - break; - case 2: - workAddress.setType( workAddress.type() | KABC::Address::Pref ); - break; - case 3: - otherAddress.setType( otherAddress.type() | KABC::Address::Pref ); - break; - default: - Q_ASSERT( !"Unknown selected_mailing_address enum" ); - break; - } - - // misc - else if ( element.tagName() == "im_address" ) - addr.insertCustom( "KADDRESSBOOK", "X-IMAddress", element.text() ); - else if ( element.tagName() == "manager" ) - addr.insertCustom( "KADDRESSBOOK", "X-ManagersName", element.text() ); - else if ( element.tagName() == "department" ) - addr.insertCustom( "KADDRESSBOOK", "X-Department", element.text() ); - else if ( element.tagName() == "assistant" ) - addr.insertCustom( "KADDRESSBOOK", "X-AssistantsName", element.text() ); - else if ( element.tagName() == "profession" ) - addr.insertCustom( "KADDRESSBOOK", "X-Profession", element.text() ); - else if ( element.tagName() == "office_location" ) - addr.insertCustom( "KADDRESSBOOK", "X-Office", element.text() ); - else if ( element.tagName() == "spouse" ) - addr.insertCustom( "KADDRESSBOOK", "X-SpousesName", element.text() ); - - else if ( element.tagName() == "bday" ) - addr.setBirthday( TQDateTime::fromString( element.text(), Qt::ISODate ) ); - else if ( element.tagName() == "anniversary" ) - addr.insertCustom( "KADDRESSBOOK", "X-Anniversary", element.text() ); - else - setCustom( element.tagName(), element.text(), addr ); - } - - node = node.nextSibling(); - } - - for ( int i = 0; i < 3; ++i ) - if ( !emails[ i ].isEmpty() ) - addr.insertEmail( emails[ i ] ); - - if ( !homeAddress.isEmpty() ) - addr.insertAddress( homeAddress ); - if ( !workAddress.isEmpty() ) - addr.insertAddress( workAddress ); - if ( !otherAddress.isEmpty() ) - addr.insertAddress( otherAddress ); - - return addr; -} diff --git a/kresources/scalix/kabc/contact.h b/kresources/scalix/kabc/contact.h deleted file mode 100644 index ad095a8d0..000000000 --- a/kresources/scalix/kabc/contact.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This file is part of the scalix resource. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 SCALIX_CONTACT_H -#define SCALIX_CONTACT_H - -#include - -namespace Scalix { - -class Contact -{ - public: - static TQString toXml( const KABC::Addressee &addr ); - static KABC::Addressee fromXml( const TQString &xml ); -}; - -} - -#endif diff --git a/kresources/scalix/kabc/resourcescalix.cpp b/kresources/scalix/kabc/resourcescalix.cpp deleted file mode 100644 index 42aef92d5..000000000 --- a/kresources/scalix/kabc/resourcescalix.cpp +++ /dev/null @@ -1,628 +0,0 @@ -/* - This file is part of the scalix resource - based on the kolab resource. - - Copyright (c) 2002 - 2004 Klarlvdalens Datakonsult AB - - - This library 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 of the License, or (at your option) any later version. - - This library 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 library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include "resourcescalix.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#include "contact.h" - -using namespace Scalix; - -class ScalixFactory : public KRES::PluginFactoryBase -{ - public: - KRES::Resource *resource( const TDEConfig *config ) - { - return new KABC::ResourceScalix( config ); - } - - KRES::ConfigWidget *configWidget( TQWidget* ) - { - return 0; - } -}; - -K_EXPORT_COMPONENT_FACTORY(kabc_scalix,ScalixFactory) - -static const char* s_kmailContentsType = "Contact"; -static const char* s_attachmentMimeTypeContact = "application/x-vnd.kolab.contact"; -static const char* s_attachmentMimeTypeDistList = "application/x-vnd.kolab.contact.distlist"; -static const char* s_inlineMimeType = "application/scalix-properties"; - -KABC::ResourceScalix::ResourceScalix( const TDEConfig *config ) - : KPIM::ResourceABC( config ), - Scalix::ResourceScalixBase( "ResourceScalix-KABC" ), - mCachedSubresource( TQString() ), mLocked( false ) -{ - setType( "scalix" ); -} - -KABC::ResourceScalix::~ResourceScalix() -{ - // The resource is deleted on exit (StdAddressBook's KStaticDeleter), - // and it wasn't closed before that, so close here to save the config. - if ( isOpen() ) { - close(); - } -} - -void KABC::ResourceScalix::loadSubResourceConfig( TDEConfig& config, - const TQString& name, - const TQString& label, - bool writable ) -{ - TDEConfigGroup group( &config, name ); - bool active = group.readBoolEntry( "Active", true ); - int completionWeight = group.readNumEntry( "CompletionWeight", 80 ); - mSubResources.insert( name, Scalix::SubResource( active, writable, label, - completionWeight ) ); -} - -bool KABC::ResourceScalix::doOpen() -{ - TDEConfig config( configFile() ); - - // Read the calendar entries - TQValueList subResources; - if ( !kmailSubresources( subResources, s_kmailContentsType ) ) - return false; - mSubResources.clear(); - TQValueList::ConstIterator it; - for ( it = subResources.begin(); it != subResources.end(); ++it ) { - loadSubResourceConfig( config, (*it).location, (*it).label, (*it).writable ); - } - - return true; -} - -void KABC::ResourceScalix::doClose() -{ - TDEConfig config( configFile() ); - - Scalix::ResourceMap::ConstIterator it; - for ( it = mSubResources.begin(); it != mSubResources.end(); ++it ) { - config.setGroup( it.key() ); - config.writeEntry( "Active", it.data().active() ); - config.writeEntry( "CompletionWeight", it.data().completionWeight() ); - } -} - -KABC::Ticket * KABC::ResourceScalix::requestSaveTicket() -{ - if ( !addressBook() ) { - kdError() << "no addressbook" << endl; - return 0; - } - mLocked = true; - - return createTicket( this ); -} - -void KABC::ResourceScalix::releaseSaveTicket( Ticket* ticket ) -{ - mLocked = false; - mCachedSubresource = TQString(); - delete ticket; -} - -TQString KABC::ResourceScalix::loadContact( const TQString& contactData, - const TQString& subResource, - TQ_UINT32 sernum, - KMailICalIface::StorageFormat ) -{ - KABC::Addressee addr = Contact::fromXml( contactData ); - - addr.setResource( this ); - addr.setChanged( false ); - KABC::Resource::insertAddressee( addr ); // same as mAddrMap.insert( addr.uid(), addr ); - mUidMap[ addr.uid() ] = StorageReference( subResource, sernum ); - kdDebug(5650) << "Loaded contact uid=" << addr.uid() << " sernum=" << sernum << " fullName=" << addr.name() << endl; - return addr.uid(); -} - -bool KABC::ResourceScalix::loadSubResource( const TQString& subResource ) -{ - bool scalixcontacts = loadSubResourceHelper( subResource, s_attachmentMimeTypeContact, KMailICalIface::StorageXML ); - bool scalixdistlists = loadSubResourceHelper( subResource, s_attachmentMimeTypeDistList, KMailICalIface::StorageXML ); - bool vcardstyle = loadSubResourceHelper( subResource, s_inlineMimeType, KMailICalIface::StorageIcalVcard ); - return scalixcontacts && scalixdistlists && vcardstyle; -} - -bool KABC::ResourceScalix::loadSubResourceHelper( const TQString& subResource, - const char* mimetype, - KMailICalIface::StorageFormat format ) -{ - int count = 0; - if ( !kmailIncidencesCount( count, mimetype, subResource ) ) { - kdError() << "Communication problem in KABC::ResourceScalix::loadSubResourceHelper()\n"; - return false; - } - if ( !count ) - return true; - - // Read that many contacts at a time. - // If this number is too small we lose time in kmail. - // If it's too big the progressbar is jumpy. - const int nbMessages = 200; - - (void)Observer::self(); // ensure kio_uiserver is running - UIServer_stub uiserver( "kio_uiserver", "UIServer" ); - int progressId = 0; - if ( count > 200 ) { - progressId = uiserver.newJob( kapp->dcopClient()->appId(), true ); - uiserver.totalFiles( progressId, count ); - uiserver.infoMessage( progressId, i18n( "Loading contacts..." ) ); - uiserver.transferring( progressId, "Contacts" ); - } - - for ( int startIndex = 0; startIndex < count; startIndex += nbMessages ) { - TQMap lst; - - if ( !kmailIncidences( lst, mimetype, subResource, startIndex, nbMessages ) ) { - kdError() << "Communication problem in ResourceScalix::load()\n"; - if ( progressId ) - uiserver.jobFinished( progressId ); - return false; - } - - for( TQMap::ConstIterator it = lst.begin(); it != lst.end(); ++it ) { - loadContact( it.data(), subResource, it.key(), format ); - } - if ( progressId ) { - uiserver.processedFiles( progressId, startIndex ); - uiserver.percent( progressId, 100 * startIndex / count ); - } - } - - kdDebug(5650) << "Contacts scalix resource: got " << count << " contacts in " << subResource << endl; - - if ( progressId ) - uiserver.jobFinished( progressId ); - return true; -} - -bool KABC::ResourceScalix::load() -{ - mUidMap.clear(); - mAddrMap.clear(); - - bool rc = true; - Scalix::ResourceMap::ConstIterator itR; - for ( itR = mSubResources.begin(); itR != mSubResources.end(); ++itR ) { - if ( !itR.data().active() ) - // This resource is disabled - continue; - - rc &= loadSubResource( itR.key() ); - } - - return rc; -} - -bool KABC::ResourceScalix::save( Ticket* ) -{ - bool rc = true; - - for( ConstIterator it = begin(); it != end(); ++it ) - if( (*it).changed() ) { - rc &= kmailUpdateAddressee( *it ); - } - - if ( !rc ) - kdDebug(5650) << k_funcinfo << " failed." << endl; - return rc; -} - -namespace Scalix { -struct AttachmentList { - TQStringList attachmentURLs; - TQStringList attachmentNames; - TQStringList attachmentMimeTypes; - TQStringList deletedAttachments; - TQValueList tempFiles; - - void addAttachment( const TQString& url, const TQString& name, const TQString& mimetype ) { - attachmentURLs.append( url ); - attachmentNames.append( name ); - attachmentMimeTypes.append( mimetype ); - } - - void updatePictureAttachment( const TQImage& image, const TQString& name ); - void updateAttachment( const TQByteArray& data, const TQString& name, const char* mimetype ); -}; -} // namespace - -void AttachmentList::updatePictureAttachment( const TQImage& image, const TQString& name ) -{ - assert( !name.isEmpty() ); - if ( !image.isNull() ) { - KTempFile* tempFile = new KTempFile; - image.save( tempFile->file(), "PNG" ); - tempFile->close(); - KURL url; - url.setPath( tempFile->name() ); - kdDebug(5650) << "picture saved to " << url.path() << endl; - addAttachment( url.url(), name, "image/png" ); - } else { - deletedAttachments.append( name ); - } -} - -void AttachmentList::updateAttachment( const TQByteArray& data, const TQString& name, const char* mimetype ) -{ - assert( !name.isEmpty() ); - if ( !data.isNull() ) { - KTempFile* tempFile = new KTempFile; - tempFile->file()->writeBlock( data ); - tempFile->close(); - KURL url; - url.setPath( tempFile->name() ); - kdDebug(5650) << "data saved to " << url.path() << endl; - addAttachment( url.url(), name, mimetype ); - } else { - deletedAttachments.append( name ); - } -} - -bool KABC::ResourceScalix::kmailUpdateAddressee( const Addressee& addr ) -{ - const TQString uid = addr.uid(); - TQString subResource; - TQ_UINT32 sernum; - if ( mUidMap.find( uid ) != mUidMap.end() ) { - subResource = mUidMap[ uid ].resource(); - if ( !subresourceWritable( subResource ) ) { - kdWarning() << "Wow! Something tried to update a non-writable addressee! Fix this caller: " << kdBacktrace() << endl; - return false; - } - sernum = mUidMap[ uid ].serialNumber(); - } else { - if ( !mCachedSubresource.isNull() ) { - subResource = mCachedSubresource; - } else { - subResource = findWritableResource( mSubResources ); - // We were locked, remember the subresource we are working with until - // we are unlocked - if ( mLocked ) - mCachedSubresource = subResource; - } - if ( subResource.isEmpty() ) - return false; - sernum = 0; - } - - AttachmentList att; - TQString subject = addr.formattedName(); - - TQString mimetype = s_inlineMimeType; - - TQString data = Contact::toXml( addr ); - - CustomHeaderMap customHeaders; - customHeaders.insert( "X-Scalix-Class", "IPM.Contact" ); - - bool rc = kmailUpdate( subResource, sernum, data, mimetype, subject, - customHeaders, - att.attachmentURLs, att.attachmentMimeTypes, att.attachmentNames, - att.deletedAttachments ); - if ( !rc ) - kdDebug(5650) << "kmailUpdate returned false!" << endl; - if ( rc ) { - kdDebug(5650) << "kmailUpdate returned, now sernum=" << sernum << " for uid=" << uid << endl; - mUidMap[ uid ] = StorageReference( subResource, sernum ); - // This is ugly, but it's faster than doing - // mAddrMap.find(addr.uid()), which would give the same :-( - // Reason for this: The Changed attribute of Addressee should - // be mutable - const_cast(addr).setChanged( false ); - } - - for( TQValueList::Iterator it = att.tempFiles.begin(); it != att.tempFiles.end(); ++it ) { - (*it)->setAutoDelete( true ); - delete (*it); - } - return rc; -} - -void KABC::ResourceScalix::insertAddressee( const Addressee& addr ) -{ - const TQString uid = addr.uid(); - //kdDebug(5650) << k_funcinfo << uid << endl; - bool ok = false; - if ( mUidMap.contains( uid ) ) { - mUidsPendingUpdate.append( uid ); - } else { - mUidsPendingAdding.append( uid ); - } - - ok = kmailUpdateAddressee( addr ); - - if ( ok ) - Resource::insertAddressee( addr ); -} - -void KABC::ResourceScalix::removeAddressee( const Addressee& addr ) -{ - const TQString uid = addr.uid(); - if ( mUidMap.find( uid ) == mUidMap.end() ) return; - //kdDebug(5650) << k_funcinfo << uid << endl; - const TQString resource = mUidMap[ uid ].resource(); - if ( !subresourceWritable( resource ) ) { - kdWarning() << "Wow! Something tried to delete a non-writable addressee! Fix this caller: " << kdBacktrace() << endl; - return; - } - /* The user told us to delete, tell KMail */ - kmailDeleteIncidence( resource, - mUidMap[ uid ].serialNumber() ); - mUidsPendingDeletion.append( uid ); - mUidMap.remove( uid ); - - Resource::removeAddressee( addr ); -} - -/* - * These are the DCOP slots that KMail call to notify when something - * changed. - */ -bool KABC::ResourceScalix::fromKMailAddIncidence( const TQString& type, - const TQString& subResource, - TQ_UINT32 sernum, - int format, - const TQString& contactXML ) -{ - // Check if this is a contact - if( type != s_kmailContentsType || !subresourceActive( subResource ) ) - return false; - - // Load contact to find the UID - const TQString uid = loadContact( contactXML, subResource, sernum, - ( KMailICalIface::StorageFormat )format ); - - //kdDebug(5650) << k_funcinfo << uid << endl; - - // Emit "addressbook changed" if this comes from kmail and not from the GUI - if ( !mUidsPendingAdding.contains( uid ) - && !mUidsPendingUpdate.contains( uid ) ) { - addressBook()->emitAddressBookChanged(); - } else { - mUidsPendingAdding.remove( uid ); - mUidsPendingUpdate.remove( uid ); - } - - return true; -} - -void KABC::ResourceScalix::fromKMailDelIncidence( const TQString& type, - const TQString& subResource, - const TQString& uid ) -{ - // Check if this is a contact - if( type != s_kmailContentsType || !subresourceActive( subResource ) ) - return; - - //kdDebug(5650) << k_funcinfo << uid << endl; - - // Can't be in both, by contract - if ( mUidsPendingDeletion.contains( uid ) ) { - mUidsPendingDeletion.remove( uid ); - } else if ( mUidsPendingUpdate.contains( uid ) ) { - // It's good to know if was deleted, but we are waiting on a new one to - // replace it, so let's just sit tight. - } else { - // We didn't trigger this, so KMail did, remove the reference to the uid - mAddrMap.remove( uid ); - mUidMap.remove( uid ); - addressBook()->emitAddressBookChanged(); - } -} - -void KABC::ResourceScalix::fromKMailRefresh( const TQString& type, - const TQString& /*subResource*/ ) -{ - // Check if this is a contact - if( type != s_kmailContentsType ) return; - - //kdDebug(5650) << k_funcinfo << endl; - - load(); // ### should call loadSubResource(subResource) probably - addressBook()->emitAddressBookChanged(); -} - -void KABC::ResourceScalix::fromKMailAddSubresource( const TQString& type, - const TQString& subResource, - const TQString& label, - bool writable ) -{ - if( type != s_kmailContentsType ) return; - - if ( mSubResources.contains( subResource ) ) - // Already registered - return; - - TDEConfig config( configFile() ); - config.setGroup( "Contact" ); - loadSubResourceConfig( config, subResource, label, writable ); - loadSubResource( subResource ); - addressBook()->emitAddressBookChanged(); - emit signalSubresourceAdded( this, type, subResource ); -} - -void KABC::ResourceScalix::fromKMailDelSubresource( const TQString& type, - const TQString& subResource ) -{ - if( type != s_kmailContentsType ) return; - - if ( !mSubResources.contains( subResource ) ) - // Not registered - return; - - // Ok, it's our job, and we have it here - mSubResources.erase( subResource ); - - TDEConfig config( configFile() ); - config.deleteGroup( subResource ); - config.sync(); - - // Make a list of all uids to remove - Scalix::UidMap::ConstIterator mapIt; - TQStringList uids; - for ( mapIt = mUidMap.begin(); mapIt != mUidMap.end(); ++mapIt ) - if ( mapIt.data().resource() == subResource ) - // We have a match - uids << mapIt.key(); - - // Finally delete all the incidences - if ( !uids.isEmpty() ) { - TQStringList::ConstIterator it; - for ( it = uids.begin(); it != uids.end(); ++it ) { - mAddrMap.remove( *it ); - mUidMap.remove( *it ); - } - - addressBook()->emitAddressBookChanged(); - } - - emit signalSubresourceRemoved( this, type, subResource ); -} - - - -void KABC::ResourceScalix::fromKMailAsyncLoadResult( const TQMap& map, - const TQString& /* type */, - const TQString& folder ) -{ - // FIXME - KMailICalIface::StorageFormat format = KMailICalIface::StorageXML; - for( TQMap::ConstIterator it = map.begin(); it != map.end(); ++it ) { - loadContact( it.data(), folder, it.key(), format ); - } - if ( !addressBook() ){ - kdDebug(5650) << "asyncLoadResult() : addressBook() returning NULL pointer.\n"; - }else - addressBook()->emitAddressBookChanged(); -} - -TQStringList KABC::ResourceScalix::subresources() const -{ - return mSubResources.keys(); -} - -bool KABC::ResourceScalix::subresourceActive( const TQString& subresource ) const -{ - if ( mSubResources.contains( subresource ) ) { - return mSubResources[ subresource ].active(); - } - - // Safe default bet: - kdDebug(5650) << "subresourceActive( " << subresource << " ): Safe bet\n"; - - return true; -} - -bool KABC::ResourceScalix::subresourceWritable( const TQString& subresource ) const -{ - if ( mSubResources.contains( subresource ) ) { - return mSubResources[ subresource ].writable(); - } - return false; //better a safe default -} - -int KABC::ResourceScalix::subresourceCompletionWeight( const TQString& subresource ) const -{ - if ( mSubResources.contains( subresource ) ) { - return mSubResources[ subresource ].completionWeight(); - } - - kdDebug(5650) << "subresourceCompletionWeight( " << subresource << " ): not found, using default\n"; - - return 80; -} - -TQString KABC::ResourceScalix::subresourceLabel( const TQString& subresource ) const -{ - if ( mSubResources.contains( subresource ) ) { - return mSubResources[ subresource ].label(); - } - - kdDebug(5650) << "subresourceLabel( " << subresource << " ): not found!\n"; - return TQString(); -} - -void KABC::ResourceScalix::setSubresourceCompletionWeight( const TQString& subresource, int completionWeight ) -{ - if ( mSubResources.contains( subresource ) ) { - mSubResources[ subresource ].setCompletionWeight( completionWeight ); - } else { - kdDebug(5650) << "setSubresourceCompletionWeight: subresource " << subresource << " not found" << endl; - } -} - -TQMap KABC::ResourceScalix::uidToResourceMap() const -{ - // TODO: Couldn't this be made simpler? - TQMap map; - Scalix::UidMap::ConstIterator mapIt; - for ( mapIt = mUidMap.begin(); mapIt != mUidMap.end(); ++mapIt ) - map[ mapIt.key() ] = mapIt.data().resource(); - return map; -} - -void KABC::ResourceScalix::setSubresourceActive( const TQString &subresource, bool active ) -{ - if ( mSubResources.contains( subresource ) ) { - mSubResources[ subresource ].setActive( active ); - load(); - } else { - kdDebug(5650) << "setSubresourceCompletionWeight: subresource " << subresource << " not found" << endl; - } -} - -#include "resourcescalix.moc" diff --git a/kresources/scalix/kabc/resourcescalix.h b/kresources/scalix/kabc/resourcescalix.h deleted file mode 100644 index dbb0b93c6..000000000 --- a/kresources/scalix/kabc/resourcescalix.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - This file is part of the scalix resource - based on the kolab resource. - - Copyright (c) 2002 - 2004 Klarlvdalens Datakonsult AB - - - This library 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 of the License, or (at your option) any later version. - - This library 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 library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef KABC_RESOURCESCALIX_H -#define KABC_RESOURCESCALIX_H - -#include -#include -#include "../shared/resourcescalixbase.h" -#include "../shared/subresource.h" -#include -#include - -namespace KABC { - - class FormatPlugin; - -/** - * This class implements a KAddressBook resource that keeps its - * addresses in an Scalix folder in KMail (or other conforming email - * clients). - */ -class KDE_EXPORT ResourceScalix : public KPIM::ResourceABC, - public Scalix::ResourceScalixBase -{ - Q_OBJECT - - -public: - /** - * Constructor - */ - ResourceScalix( const TDEConfig* ); - - /** - * Destructor. - */ - virtual ~ResourceScalix(); - - /** - * Open the contacts list - */ - virtual bool doOpen(); - - /** - * Request a ticket, you have to pass through save() to - * allow locking. - */ - virtual Ticket *requestSaveTicket(); - - /** - Releases the ticket previousely requested with requestSaveTicket(). - The resource has to remove its locks in this function. - */ - virtual void releaseSaveTicket( Ticket* ); - - /** - * Load all addressees to the addressbook - */ - virtual bool load(); - - /** - * Save all addressees to the addressbook. - * - * @param ticket The ticket you get by requestSaveTicket() - */ - virtual bool save( Ticket *ticket ); - - /** - Insert an addressee into the resource. - */ - virtual void insertAddressee( const Addressee& ); - - /** - * Removes a addressee from resource. This method is mainly - * used by record-based resources like LDAP or SQL. - */ - virtual void removeAddressee( const Addressee& addr ); - - // Listen to KMail changes in the amount of sub resources - void fromKMailAddSubresource( const TQString& type, const TQString& id, - const TQString& label, bool writable ); - void fromKMailDelSubresource( const TQString& type, const TQString& id ); - - bool fromKMailAddIncidence( const TQString& type, const TQString& resource, - TQ_UINT32 sernum, int format, const TQString& contact ); - void fromKMailDelIncidence( const TQString& type, const TQString& resource, - const TQString& contact ); - void fromKMailRefresh( const TQString& type, const TQString& resource ); - - void fromKMailAsyncLoadResult( const TQMap& map, - const TQString& type, - const TQString& folder ); - - /// Return the list of subresources. - TQStringList subresources() const; - - /// Is this subresource active? - bool subresourceActive( const TQString& ) const; - /// Is this subresource writabel? - bool subresourceWritable( const TQString& ) const; - - virtual void setSubresourceActive( const TQString &, bool ); - - /// Completion weight for a given subresource - virtual int subresourceCompletionWeight( const TQString& ) const; - - /// Label for a given subresource - virtual TQString subresourceLabel( const TQString& ) const; - - /// Set completion weight for a given subresource - virtual void setSubresourceCompletionWeight( const TQString&, int ); - - /// Give the uidmap. Used for ordered searching - TQMap uidToResourceMap() const; - -protected: - bool kmailUpdateAddressee( const Addressee& ); - - void doClose(); - - void loadSubResourceConfig( TDEConfig& config, const TQString& name, - const TQString& label, bool writable ); - bool loadSubResource( const TQString& subResource ); - bool loadSubResourceHelper( const TQString& subResource, const char* mimetype, KMailICalIface::StorageFormat format ); - TQString loadContact( const TQString& contactData, const TQString& subResource, - TQ_UINT32 sernum, const KMailICalIface::StorageFormat format ); - - TQString configFile() const { - return Scalix::ResourceScalixBase::configFile( "kabc" ); - } - - // The list of subresources - Scalix::ResourceMap mSubResources; - TQString mCachedSubresource; - bool mLocked; -}; - -} - -#endif // KABC_RESOURCESCALIX_H diff --git a/kresources/scalix/kabc/resourcescalix_plugin.cpp b/kresources/scalix/kabc/resourcescalix_plugin.cpp deleted file mode 100644 index bbf7a436a..000000000 --- a/kresources/scalix/kabc/resourcescalix_plugin.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - This file is part of the scalix resource - based on the kolab resource. - - Copyright (c) 2002 - 2004 Klarlvdalens Datakonsult AB - - - This library 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 of the License, or (at your option) any later version. - - This library 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 library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include "resourcescalix.h" - -using namespace Scalix; - -class ScalixFactory : public KRES::PluginFactoryBase -{ - public: - KRES::Resource *resource( const TDEConfig *config ) - { - return new KABC::ResourceScalix( config ); - } - - KRES::ConfigWidget *configWidget( TQWidget* ) - { - return 0; - } -}; - -K_EXPORT_COMPONENT_FACTORY(kabc_scalix,ScalixFactory) - diff --git a/kresources/scalix/kabc/scalix.desktop b/kresources/scalix/kabc/scalix.desktop deleted file mode 100644 index 3f483dff6..000000000 --- a/kresources/scalix/kabc/scalix.desktop +++ /dev/null @@ -1,30 +0,0 @@ -[Desktop Entry] -Name=Addressbook on Scalix Server via KMail -Name[bg]=Адресник на сървъра Scalix през KMail -Name[ca]=Llibreta d'adreces en un servidor Scalix mitjançant el KMail -Name[da]=Adressebog på Scalix-server via KMail -Name[de]=Adressbuch auf einem Scalix-Server via KMail -Name[el]=Βιβλίο διευθύνσεων σε εξυπηρετητή Scalix μέσω του KMail -Name[es]=Libreta de direcciones en servidor Scalix por medio de KMail -Name[et]=Aadressiraamat Scalix-serveris (KMaili vahendusel) -Name[fr]=Carnet d'adresses sur serveur Scalix via KMail -Name[is]=Vistfangaskrá á Scalix-þjóni gegnum KMail -Name[it]=Rubrica indirizzi su server Scalix via KMail -Name[ja]=KMail 経由 Scalix サーバのアドレス帳 -Name[km]=សៀវភៅ​អាសយដ្ឋាន​នៅ​លើ​ម៉ាស៊ីន​បម្រើ Scalix តាម​រយៈ KMail -Name[nds]=Adressbook op Scalix-Server över KMail -Name[nl]=Adresboek op Scalix-server via KMail -Name[pl]=Książka adresowa na serwerze Scalix za pośrednictwem KMaila -Name[ru]=Адресная книга на сервере Scalix через KMail -Name[sk]=Adresár na Scalix serveri pomocou KMail -Name[sr]=Адресар на Scalix серверу преко KMail-а -Name[sr@Latn]=Adresar na Scalix serveru preko KMail-a -Name[sv]=Adressbok på Scalix-server via Kmail -Name[tr]=KMail Aracılığı ile Scalix Sunucusunda Adres Defteri -Name[zh_CN]=通过 KMail 访问 Scalix 服务器上的地址簿 -Name[zh_TW]=透過 KMail 取得 Scalix 伺服器上的通訊錄 -X-TDE-Library=kabc_scalix -Type=Service -ServiceTypes=KResources/Plugin -X-TDE-ResourceFamily=contact -X-TDE-ResourceType=scalix diff --git a/kresources/scalix/kcal/CMakeLists.txt b/kresources/scalix/kcal/CMakeLists.txt deleted file mode 100644 index 40d56921a..000000000 --- a/kresources/scalix/kcal/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_SOURCE_DIR} - ${CMAKE_SOURCE_DIR}/libtdepim - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -##### other data ################################ - -install( - FILES scalix.desktop - DESTINATION ${SERVICES_INSTALL_DIR}/kresources/kcal ) - -install( - FILES ../uninstall.desktop - RENAME imap.desktop - DESTINATION ${SERVICES_INSTALL_DIR}/kresources/kcal ) - - -##### kcal_scalix (module) ###################### - -tde_add_kpart( kcal_scalix AUTOMOC - SOURCES resourcescalix_plugin.cpp - LINK kcalscalix-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) - - -##### kcalscalix (shared) ####################### - -tde_add_library( kcalscalix SHARED AUTOMOC - SOURCES resourcescalix.cpp - VERSION 0.0.0 - LINK resourcescalixshared-static kgroupwarebase-shared - DESTINATION ${LIB_INSTALL_DIR} -) diff --git a/kresources/scalix/kcal/Makefile.am b/kresources/scalix/kcal/Makefile.am deleted file mode 100644 index c124e48dd..000000000 --- a/kresources/scalix/kcal/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -METASOURCES = AUTO - -INCLUDES = -I$(top_srcdir)/kresources/scalix/shared -I$(top_srcdir) \ - -I$(top_builddir)/libtdepim $(all_includes) - -# The scalix wizard links to this library too -lib_LTLIBRARIES = libkcalscalix.la - -libkcalscalix_la_SOURCES = resourcescalix.cpp -libkcalscalix_la_LDFLAGS = $(all_libraries) -no-undefined -libkcalscalix_la_LIBADD = $(top_builddir)/libkcal/libkcal.la \ - $(top_builddir)/kresources/scalix/shared/libresourcescalixshared.la \ - -lkresources - -kde_module_LTLIBRARIES = kcal_scalix.la - -kcal_scalix_la_SOURCES = resourcescalix_plugin.cpp -kcal_scalix_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -no-undefined -kcal_scalix_la_LIBADD = libkcalscalix.la - -servicedir = $(kde_servicesdir)/kresources/kcal -service_DATA = scalix.desktop - -install-data-local: $(srcdir)/../uninstall.desktop - $(mkinstalldirs) $(DESTDIR)$(servicedir) - $(INSTALL_DATA) $(srcdir)/../uninstall.desktop $(DESTDIR)$(servicedir)/imap.desktop - diff --git a/kresources/scalix/kcal/resourcescalix.cpp b/kresources/scalix/kcal/resourcescalix.cpp deleted file mode 100644 index a757c81fc..000000000 --- a/kresources/scalix/kcal/resourcescalix.cpp +++ /dev/null @@ -1,903 +0,0 @@ -/* - This file is part of the scalix resource - based on the kolab resource. - - Copyright (c) 2004 Bo Thorsen - 2004 Till Adam - - This library 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 of the License, or (at your option) any later version. - - This library 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 library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include "resourcescalix.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -using namespace KCal; -using namespace Scalix; - -static const char* kmailCalendarContentsType = "Calendar"; -static const char* kmailTodoContentsType = "Task"; -static const char* kmailJournalContentsType = "Journal"; -static const char* eventAttachmentMimeType = "application/x-vnd.kolab.event"; -static const char* todoAttachmentMimeType = "application/x-vnd.kolab.task"; -static const char* journalAttachmentMimeType = "application/x-vnd.kolab.journal"; -static const char* incidenceInlineMimeType = "text/calendar"; - - -ResourceScalix::ResourceScalix( const TDEConfig *config ) - : ResourceCalendar( config ), ResourceScalixBase( "ResourceScalix-libkcal" ), - mCalendar( TQString::fromLatin1("UTC") ), mOpen( false ) -{ - setType( "scalix" ); - connect( &mResourceChangedTimer, TQT_SIGNAL( timeout() ), - this, TQT_SLOT( slotEmitResourceChanged() ) ); -} - -ResourceScalix::~ResourceScalix() -{ - // The resource is deleted on exit (StdAddressBook's KStaticDeleter), - // and it wasn't closed before that, so close here to save the config. - if ( mOpen ) { - close(); - } -} - -void ResourceScalix::loadSubResourceConfig( TDEConfig& config, - const TQString& name, - const TQString& label, - bool writable, - ResourceMap& subResource ) -{ - TDEConfigGroup group( &config, name ); - bool active = group.readBoolEntry( "Active", true ); - subResource.insert( name, Scalix::SubResource( active, writable, label ) ); -} - -bool ResourceScalix::openResource( TDEConfig& config, const char* contentType, - ResourceMap& map ) -{ - // Read the subresource entries from KMail - TQValueList subResources; - if ( !kmailSubresources( subResources, contentType ) ) - return false; - map.clear(); - TQValueList::ConstIterator it; - for ( it = subResources.begin(); it != subResources.end(); ++it ) - loadSubResourceConfig( config, (*it).location, (*it).label, (*it).writable, map ); - return true; -} - -bool ResourceScalix::doOpen() -{ - if ( mOpen ) - // Already open - return true; - mOpen = true; - - TDEConfig config( configFile() ); - config.setGroup( "General" ); - mProgressDialogIncidenceLimit = config.readNumEntry("ProgressDialogIncidenceLimit", 200); - - return openResource( config, kmailCalendarContentsType, mEventSubResources ) - && openResource( config, kmailTodoContentsType, mTodoSubResources ) - && openResource( config, kmailJournalContentsType, mJournalSubResources ); -} - -static void closeResource( TDEConfig& config, ResourceMap& map ) -{ - ResourceMap::ConstIterator it; - for ( it = map.begin(); it != map.end(); ++it ) { - config.setGroup( it.key() ); - config.writeEntry( "Active", it.data().active() ); - } -} - -void ResourceScalix::doClose() -{ - if ( !mOpen ) - // Not open - return; - mOpen = false; - - TDEConfig config( configFile() ); - closeResource( config, mEventSubResources ); - closeResource( config, mTodoSubResources ); - closeResource( config, mJournalSubResources ); -} - -bool ResourceScalix::loadSubResource( const TQString& subResource, - const char* mimetype ) -{ - int count = 0; - if ( !kmailIncidencesCount( count, mimetype, subResource ) ) { - kdError(5650) << "Communication problem in ResourceScalix::load()\n"; - return false; - } - - if ( !count ) - return true; - - const int nbMessages = 200; // read 200 mails at a time (see kabc resource) - - const TQString labelTxt = !strcmp(mimetype, "application/x-vnd.kolab.task") ? i18n( "Loading tasks..." ) - : !strcmp(mimetype, "application/x-vnd.kolab.journal") ? i18n( "Loading journals..." ) - : i18n( "Loading events..." ); - const bool useProgress = tqApp && tqApp->type() != TQApplication::Tty && count > mProgressDialogIncidenceLimit; - if ( useProgress ) - (void)::Observer::self(); // ensure kio_uiserver is running - UIServer_stub uiserver( "kio_uiserver", "UIServer" ); - int progressId = 0; - if ( useProgress ) { - progressId = uiserver.newJob( kapp->dcopClient()->appId(), true ); - uiserver.totalFiles( progressId, count ); - uiserver.infoMessage( progressId, labelTxt ); - uiserver.transferring( progressId, labelTxt ); - } - - for ( int startIndex = 0; startIndex < count; startIndex += nbMessages ) { - TQMap lst; - if ( !kmailIncidences( lst, mimetype, subResource, startIndex, nbMessages ) ) { - kdError(5650) << "Communication problem in ResourceScalix::load()\n"; - if ( progressId ) - uiserver.jobFinished( progressId ); - return false; - } - - { // for RAII scoping below - TemporarySilencer t( this ); - for( TQMap::ConstIterator it = lst.begin(); it != lst.end(); ++it ) { - addIncidence( mimetype, it.data(), subResource, it.key() ); - } - } - if ( progressId ) { - uiserver.processedFiles( progressId, startIndex ); - uiserver.percent( progressId, 100 * startIndex / count ); - } - } - - if ( progressId ) - uiserver.jobFinished( progressId ); - return true; -} - -bool ResourceScalix::doLoad() -{ - mUidMap.clear(); - - return loadAllEvents() & loadAllTodos() & loadAllJournals(); -} - -bool ResourceScalix::doLoadAll( ResourceMap& map, const char* mimetype ) -{ - bool rc = true; - for ( ResourceMap::ConstIterator it = map.begin(); it != map.end(); ++it ) { - if ( !it.data().active() ) - // This resource is disabled - continue; - - rc &= loadSubResource( it.key(), mimetype ); - } - return rc; -} - -bool ResourceScalix::loadAllEvents() -{ - removeIncidences( "Event" ); - mCalendar.deleteAllEvents(); - return doLoadAll( mEventSubResources, incidenceInlineMimeType ); -} - -bool ResourceScalix::loadAllTodos() -{ - removeIncidences( "Todo" ); - mCalendar.deleteAllTodos(); - return doLoadAll( mTodoSubResources, incidenceInlineMimeType ); -} - -bool ResourceScalix::loadAllJournals() -{ - removeIncidences( "Journal" ); - mCalendar.deleteAllJournals(); - return doLoadAll( mJournalSubResources, incidenceInlineMimeType ); -} - -void ResourceScalix::removeIncidences( const TQCString& incidenceType ) -{ - Scalix::UidMap::Iterator mapIt = mUidMap.begin(); - while ( mapIt != mUidMap.end() ) - { - Scalix::UidMap::Iterator it = mapIt++; - // Check the type of this uid: event, todo or journal. - // Need to look up in mCalendar for that. Given the implementation of incidence(uid), - // better call event(uid), todo(uid) etc. directly. - - // A faster but hackish way would probably be to check the type of the resource, - // like mEventSubResources.find( it.data().resource() ) != mEventSubResources.end() ? - const TQString& uid = it.key(); - if ( incidenceType == "Event" && mCalendar.event( uid ) ) - mUidMap.remove( it ); - else if ( incidenceType == "Todo" && mCalendar.todo( uid ) ) - mUidMap.remove( it ); - else if ( incidenceType == "Journal" && mCalendar.journal( uid ) ) - mUidMap.remove( it ); - } -} - -bool ResourceScalix::doSave() -{ - return true; -} - -void ResourceScalix::incidenceUpdated( KCal::IncidenceBase* incidencebase ) -{ - if ( incidencebase->isReadOnly() ) return; // Should not happen (TM) - incidencebase->setSyncStatus( KCal::Event::SYNCMOD ); - incidencebase->setLastModified( TQDateTime::currentDateTime() ); - // we should probably update the revision number here, - // or internally in the Event itself when certain things change. - // need to verify with ical documentation. - - const TQString uid = incidencebase->uid(); - - if ( mUidsPendingUpdate.contains( uid ) || mUidsPendingAdding.contains( uid ) ) { - /* We are currently processing this event ( removing and readding or - * adding it ). If so, ignore this update. Keep the last of these around - * and process once we hear back from KMail on this event. */ - mPendingUpdates.replace( uid, incidencebase ); - return; - } - - TQString subResource; - TQ_UINT32 sernum = 0; - if ( mUidMap.contains( uid ) ) { - subResource = mUidMap[ uid ].resource(); - sernum = mUidMap[ uid ].serialNumber(); - mUidsPendingUpdate.append( uid ); - } - sendKMailUpdate( incidencebase, subResource, sernum ); -} - -void ResourceScalix::resolveConflict( KCal::Incidence* inc, const TQString& subresource, TQ_UINT32 sernum ) -{ - if ( ! inc ) - return; - if ( ! mResolveConflict ) { - // we should do no conflict resolution - delete inc; - return; - } - Incidence* local = mCalendar.incidence( inc->uid() ); - Incidence* localIncidence = 0; - Incidence* addedIncidence = 0; - if ( local ) { - KIncidenceChooser* ch = new KIncidenceChooser(); - ch->setIncidence( local ,inc ); - if ( KIncidenceChooser::chooseMode == KIncidenceChooser::ask ) { - connect ( this, TQT_SIGNAL( useGlobalMode() ), ch, TQT_SLOT ( useGlobalMode() ) ); - if ( ch->exec() ) - if ( KIncidenceChooser::chooseMode != KIncidenceChooser::ask ) - emit useGlobalMode() ; - } - Incidence* result = ch->getIncidence(); - delete ch; - if ( result == local ) { - localIncidence = local->clone(); - delete inc; - } else if ( result == inc ) { - addedIncidence = inc; - } else if ( result == 0 ) { // take both - localIncidence = local->clone(); - localIncidence->recreate(); - localIncidence->setSummary( i18n("Copy of: %1").arg(localIncidence->summary()) ); - addedIncidence = inc; - } - bool silent = mSilent; - mSilent = false; - deleteIncidence( local ); // remove local from kmail - kmailDeleteIncidence( subresource, sernum );// remove new from kmail - if ( localIncidence ) { - addIncidence( localIncidence, subresource, 0 ); - mUidsPendingAdding.remove( localIncidence->uid() ); // we do want to inform KOrg also - } - if ( addedIncidence ) { - addIncidence( addedIncidence, subresource, 0 ); - mUidsPendingAdding.remove( addedIncidence->uid() ); // we do want to inform KOrg also - } - mSilent = silent; - } -} -void ResourceScalix::addIncidence( const char* mimetype, const TQString& data, - const TQString& subResource, TQ_UINT32 sernum ) -{ - // This uses pointer comparison, so it only works if we use the static - // objects defined in the top of the file - Incidence *inc = mFormat.fromString( data ); - addIncidence( inc, subResource, sernum ); -} - - -bool ResourceScalix::sendKMailUpdate( KCal::IncidenceBase* incidencebase, const TQString& subresource, - TQ_UINT32 sernum ) -{ - const TQString& type = incidencebase->type(); - const char* mimetype = 0; - TQString data; - if ( type == "Event" ) { - mimetype = incidenceInlineMimeType; - data = mFormat.createScheduleMessage( static_cast(incidencebase), - Scheduler::Publish ); - } else if ( type == "Todo" ) { - mimetype = incidenceInlineMimeType; - data = mFormat.createScheduleMessage( static_cast(incidencebase), - Scheduler::Publish ); - } else if ( type == "Journal" ) { - mimetype = incidenceInlineMimeType; - data = mFormat.createScheduleMessage( static_cast(incidencebase), - Scheduler::Publish ); - } else { - kdWarning(5006) << "Can't happen: unhandled type=" << type << endl; - } - -// kdDebug() << k_funcinfo << "Data string:\n" << data << endl; - - KCal::Incidence* incidence = static_cast( incidencebase ); - CustomHeaderMap customHeaders; - - if ( type == "Event" ) - customHeaders.insert( "X-Scalix-Class", "IPM.Appointment" ); - else if ( type == "Todo" ) - customHeaders.insert( "X-Scalix-Class", "IPM.Task" ); - - TQString subject = incidence->summary(); - - // behold, sernum is an in-parameter - const bool rc = kmailUpdate( subresource, sernum, data, mimetype, subject, customHeaders ); - // update the serial number - if ( mUidMap.contains( incidencebase->uid() ) ) { - mUidMap[ incidencebase->uid() ].setSerialNumber( sernum ); - } - return rc; -} - -bool ResourceScalix::addIncidence( KCal::Incidence* incidence, const TQString& _subresource, - TQ_UINT32 sernum ) -{ - Q_ASSERT( incidence ); - if ( !incidence ) return false; - const TQString &uid = incidence->uid(); - TQString subResource = _subresource; - - Scalix::ResourceMap *map = &mEventSubResources; // don't use a ref here! - - const TQString& type = incidence->type(); - if ( type == "Event" ) - map = &mEventSubResources; - else if ( type == "Todo" ) - map = &mTodoSubResources; - else if ( type == "Journal" ) - map = &mJournalSubResources; - else - kdWarning() << "unknown type " << type << endl; - - if ( !mSilent ) { /* We got this one from the user, tell KMail. */ - // Find out if this event was previously stored in KMail - bool newIncidence = _subresource.isEmpty(); - if ( newIncidence ) { - subResource = findWritableResource( *map ); - } - - if ( subResource.isEmpty() ) - return false; - - mNewIncidencesMap.insert( uid, subResource ); - - if ( !sendKMailUpdate( incidence, subResource, sernum ) ) { - kdError(5650) << "Communication problem in ResourceScalix::addIncidence()\n"; - return false; - } else { - // KMail is doing it's best to add the event now, put a sticker on it, - // so we know it's one of our transient ones - mUidsPendingAdding.append( uid ); - - /* Add to the cache immediately if this is a new event coming from - * KOrganizer. It relies on the incidence being in the calendar when - * addIncidence returns. */ - if ( newIncidence ) { - mCalendar.addIncidence( incidence ); - incidence->registerObserver( this ); - } - } - } else { /* KMail told us */ - bool ourOwnUpdate = false; - /* Check if we updated this one, which means kmail deleted and added it. - * We know the new state, so lets just not do much at all. The old incidence - * in the calendar remains valid, but the serial number changed, so we need to - * update that */ - if ( ourOwnUpdate = mUidsPendingUpdate.contains( uid ) ) { - mUidsPendingUpdate.remove( uid ); - mUidMap.remove( uid ); - mUidMap[ uid ] = StorageReference( subResource, sernum ); - } else { - /* This is a real add, from KMail, we didn't trigger this ourselves. - * If this uid already exists in this folder, do conflict resolution, - * unless the folder is read-only, in which case the user should not be - * offered a means of putting mails in a folder she'll later be unable to - * upload. Skip the incidence, in this case. */ - if ( mUidMap.contains( uid ) - && ( mUidMap[ uid ].resource() == subResource ) ) { - if ( (*map)[ subResource ].writable() ) { - resolveConflict( incidence, subResource, sernum ); - } else { - kdWarning( 5650 ) << "Duplicate event in a read-only folder detected! " - "Please inform the owner of the folder. " << endl; - } - return true; - } - /* Add to the cache if the add didn't come from KOrganizer, in which case - * we've already added it, and listen to updates from KOrganizer for it. */ - if ( !mUidsPendingAdding.contains( uid ) ) { - mCalendar.addIncidence( incidence ); - incidence->registerObserver( this ); - } - if ( !subResource.isEmpty() && sernum != 0 ) { - mUidMap[ uid ] = StorageReference( subResource, sernum ); - incidence->setReadOnly( !(*map)[ subResource ].writable() ); - } - } - /* Check if there are updates for this uid pending and if so process them. */ - if ( KCal::IncidenceBase *update = mPendingUpdates.find( uid ) ) { - mSilent = false; // we do want to tell KMail - mPendingUpdates.remove( uid ); - incidenceUpdated( update ); - } else { - /* If the uid was added by KMail, KOrganizer needs to be told, so - * schedule emitting of the resourceChanged signal. */ - if ( !mUidsPendingAdding.contains( uid ) ) { - if ( !ourOwnUpdate ) mResourceChangedTimer.changeInterval( 100 ); - } else { - mUidsPendingAdding.remove( uid ); - } - } - - mNewIncidencesMap.remove( uid ); - } - return true; -} - - -bool ResourceScalix::addEvent( KCal::Event* event ) -{ - if ( mUidMap.contains( event->uid() ) ) - return true; //noop - else - return addIncidence( event, TQString(), 0 ); -} - -bool ResourceScalix::addEvent( KCal::Event *event, const TQString &subresource ) -{ - Q_UNUSED( subresource ); // ResourceScalix does not support subresources - return this->addEvent( event ); -} - -bool ResourceScalix::deleteIncidence( KCal::Incidence* incidence ) -{ - if ( incidence->isReadOnly() ) return false; - - const TQString uid = incidence->uid(); - if( !mUidMap.contains( uid ) ) return false; // Odd - /* The user told us to delete, tell KMail */ - if ( !mSilent ) { - kmailDeleteIncidence( mUidMap[ uid ].resource(), - mUidMap[ uid ].serialNumber() ); - mUidsPendingDeletion.append( uid ); - incidence->unRegisterObserver( this ); - mCalendar.deleteIncidence( incidence ); - mUidMap.remove( uid ); - } else { - assert( false ); // If this still happens, something is very wrong - } - return true; -} - -bool ResourceScalix::deleteEvent( KCal::Event* event ) -{ - return deleteIncidence( event ); -} - -KCal::Event* ResourceScalix::event( const TQString& uid ) -{ - return mCalendar.event(uid); -} - -KCal::Event::List ResourceScalix::rawEvents( EventSortField sortField, SortDirection sortDirection ) -{ - return mCalendar.rawEvents( sortField, sortDirection ); -} - -KCal::Event::List ResourceScalix::rawEventsForDate( const TQDate& date, - EventSortField sortField, - SortDirection sortDirection ) -{ - return mCalendar.rawEventsForDate( date, sortField, sortDirection ); -} - -KCal::Event::List ResourceScalix::rawEventsForDate( const TQDateTime& qdt ) -{ - return mCalendar.rawEventsForDate( qdt ); -} - -KCal::Event::List ResourceScalix::rawEvents( const TQDate& start, - const TQDate& end, - bool inclusive ) -{ - return mCalendar.rawEvents( start, end, inclusive ); -} - -bool ResourceScalix::addTodo( KCal::Todo* todo ) -{ - if ( mUidMap.contains( todo->uid() ) ) - return true; //noop - else - return addIncidence( todo, TQString(), 0 ); -} - -bool ResourceScalix::addTodo( KCal::Todo *todo, const TQString &subresource ) -{ - Q_UNUSED( subresource ); // ResourceScalix does not support subresources - return this->addTodo( todo ); -} - -bool ResourceScalix::deleteTodo( KCal::Todo* todo ) -{ - return deleteIncidence( todo ); -} - -KCal::Todo* ResourceScalix::todo( const TQString& uid ) -{ - return mCalendar.todo( uid ); -} - -KCal::Todo::List ResourceScalix::rawTodos( TodoSortField sortField, SortDirection sortDirection ) -{ - return mCalendar.rawTodos( sortField, sortDirection ); -} - -KCal::Todo::List ResourceScalix::rawTodosForDate( const TQDate& date ) -{ - return mCalendar.rawTodosForDate( date ); -} - -bool ResourceScalix::addJournal( KCal::Journal* journal ) -{ - if ( mUidMap.contains( journal->uid() ) ) - return true; //noop - else - return addIncidence( journal, TQString(), 0 ); -} - -bool ResourceScalix::addJournal( KCal::Journal *journal, const TQString &subresource ) -{ - Q_UNUSED( subresource ); // ResourceScalix does not support subresources - return this->addJournal( journal ); -} - -bool ResourceScalix::deleteJournal( KCal::Journal* journal ) -{ - return deleteIncidence( journal ); -} - -KCal::Journal* ResourceScalix::journal( const TQString& uid ) -{ - return mCalendar.journal(uid); -} - -KCal::Journal::List ResourceScalix::rawJournals( JournalSortField sortField, SortDirection sortDirection ) -{ - return mCalendar.rawJournals( sortField, sortDirection ); -} - -KCal::Journal::List ResourceScalix::rawJournalsForDate( const TQDate &date ) -{ - return mCalendar.rawJournalsForDate( date ); -} - -KCal::Alarm::List ResourceScalix::alarms( const TQDateTime& from, - const TQDateTime& to ) -{ - return mCalendar.alarms( from, to ); -} - -KCal::Alarm::List ResourceScalix::alarmsTo( const TQDateTime& to ) -{ - return mCalendar.alarmsTo(to); -} - -void ResourceScalix::setTimeZoneId( const TQString& tzid ) -{ - mCalendar.setTimeZoneId( tzid ); - mFormat.setTimeZone( mCalendar.timeZoneId(), !mCalendar.isLocalTime() ); -} - -bool ResourceScalix::fromKMailAddIncidence( const TQString& type, - const TQString& subResource, - TQ_UINT32 sernum, - int /*format*/, - const TQString& data ) -{ - bool rc = true; - TemporarySilencer t( this ); // RAII - if ( type != kmailCalendarContentsType && type != kmailTodoContentsType - && type != kmailJournalContentsType ) - // Not ours - return false; - if ( !subresourceActive( subResource ) ) return true; - - Incidence *inc = mFormat.fromString( data ); - if ( !inc ) - rc = false; - else - addIncidence( inc, subResource, sernum ); - - return rc; -} - -void ResourceScalix::fromKMailDelIncidence( const TQString& type, - const TQString& subResource, - const TQString& uid ) -{ - if ( type != kmailCalendarContentsType && type != kmailTodoContentsType - && type != kmailJournalContentsType ) - // Not ours - return; - if ( !subresourceActive( subResource ) ) return; - - // Can't be in both, by contract - if ( mUidsPendingDeletion.contains( uid ) ) { - mUidsPendingDeletion.remove( uid ); - } else if ( mUidsPendingUpdate.contains( uid ) ) { - // It's good to know if was deleted, but we are waiting on a new one to - // replace it, so let's just sit tight. - } else { - // We didn't trigger this, so KMail did, remove the reference to the uid - KCal::Incidence* incidence = mCalendar.incidence( uid ); - if( incidence ) { - incidence->unRegisterObserver( this ); - mCalendar.deleteIncidence( incidence ); - } - mUidMap.remove( uid ); - mResourceChangedTimer.changeInterval( 100 ); - } -} - -void ResourceScalix::fromKMailRefresh( const TQString& type, - const TQString& /*subResource*/ ) -{ - // TODO: Only load the specified subResource - if ( type == "Calendar" ) - loadAllEvents(); - else if ( type == "Task" ) - loadAllTodos(); - else if ( type == "Journal" ) - loadAllJournals(); - else - kdWarning(5006) << "KCal Scalix resource: fromKMailRefresh: unknown type " << type << endl; - mResourceChangedTimer.changeInterval( 100 ); -} - -void ResourceScalix::fromKMailAddSubresource( const TQString& type, - const TQString& subResource, - const TQString& label, - bool writable ) -{ - ResourceMap* map = 0; - const char* mimetype = 0; - if ( type == kmailCalendarContentsType ) { - map = &mEventSubResources; - mimetype = eventAttachmentMimeType; - } else if ( type == kmailTodoContentsType ) { - map = &mTodoSubResources; - mimetype = todoAttachmentMimeType; - } else if ( type == kmailJournalContentsType ) { - map = &mJournalSubResources; - mimetype = journalAttachmentMimeType; - } else - // Not ours - return; - - if ( map->contains( subResource ) ) - // Already registered - return; - - TDEConfig config( configFile() ); - config.setGroup( subResource ); - - bool active = config.readBoolEntry( subResource, true ); - (*map)[ subResource ] = Scalix::SubResource( active, writable, label ); - loadSubResource( subResource, mimetype ); - emit signalSubresourceAdded( this, type, subResource, label ); -} - -void ResourceScalix::fromKMailDelSubresource( const TQString& type, - const TQString& subResource ) -{ - ResourceMap* map = subResourceMap( type ); - if ( !map ) // not ours - return; - if ( map->contains( subResource ) ) - map->erase( subResource ); - else - // Not registered - return; - - // Delete from the config file - TDEConfig config( configFile() ); - config.deleteGroup( subResource ); - config.sync(); - - // Make a list of all uids to remove - Scalix::UidMap::ConstIterator mapIt; - TQStringList uids; - for ( mapIt = mUidMap.begin(); mapIt != mUidMap.end(); ++mapIt ) - if ( mapIt.data().resource() == subResource ) - // We have a match - uids << mapIt.key(); - - // Finally delete all the incidences - if ( !uids.isEmpty() ) { - TemporarySilencer t( this ); - TQStringList::ConstIterator it; - for ( it = uids.begin(); it != uids.end(); ++it ) { - KCal::Incidence* incidence = mCalendar.incidence( *it ); - if( incidence ) - mCalendar.deleteIncidence( incidence ); - mUidMap.remove( *it ); - } - } - - emit signalSubresourceRemoved( this, type, subResource ); -} - -TQStringList ResourceScalix::subresources() const -{ - // Workaround: The ResourceView in KOrganizer wants to know this - // before it opens the resource :-( Make sure we are open - const_cast( this )->doOpen(); - return ( mEventSubResources.keys() - + mTodoSubResources.keys() - + mJournalSubResources.keys() ); -} - -const TQString -ResourceScalix::labelForSubresource( const TQString& subresource ) const -{ - if ( mEventSubResources.contains( subresource ) ) - return mEventSubResources[ subresource ].label(); - if ( mTodoSubResources.contains( subresource ) ) - return mTodoSubResources[ subresource ].label(); - if ( mJournalSubResources.contains( subresource ) ) - return mJournalSubResources[ subresource ].label(); - return subresource; -} - -TQString ResourceScalix::subresourceIdentifier( Incidence *incidence ) -{ - TQString uid = incidence->uid(); - if ( mUidMap.contains( uid ) ) - return mUidMap[ uid ].resource(); - else - if ( mNewIncidencesMap.contains( uid ) ) - return mNewIncidencesMap[ uid ]; - else - return TQString(); -} - -void ResourceScalix::fromKMailAsyncLoadResult( const TQMap& map, - const TQString& type, - const TQString& folder ) -{ - TemporarySilencer t( this ); - for( TQMap::ConstIterator it = map.begin(); it != map.end(); ++it ) - addIncidence( type.latin1(), it.data(), folder, it.key() ); -} - -bool ResourceScalix::subresourceActive( const TQString& subresource ) const -{ - // Workaround: The ResourceView in KOrganizer wants to know this - // before it opens the resource :-( Make sure we are open - const_cast( this )->doOpen(); - - if ( mEventSubResources.contains( subresource ) ) - return mEventSubResources[ subresource ].active(); - if ( mTodoSubResources.contains( subresource ) ) - return mTodoSubResources[ subresource ].active(); - if ( mJournalSubResources.contains( subresource ) ) - return mJournalSubResources[ subresource ].active(); - - // Safe default bet: - kdDebug(5650) << "subresourceActive( " << subresource << " ): Safe bet\n"; - - return true; -} - -void ResourceScalix::setSubresourceActive( const TQString &subresource, bool v ) -{ - ResourceMap *map = 0; - - if ( mEventSubResources.contains( subresource ) ) - map = &mEventSubResources; - if ( mTodoSubResources.contains( subresource ) ) - map = &mTodoSubResources; - if ( mJournalSubResources.contains( subresource ) ) - map = &mJournalSubResources; - - if ( map && ( ( *map )[ subresource ].active() != v ) ) { - ( *map )[ subresource ].setActive( v ); - doLoad(); // refresh the mCalendar cache - mResourceChangedTimer.changeInterval( 100 ); - } -} - -void ResourceScalix::slotEmitResourceChanged() -{ - kdDebug(5650) << "KCal Scalix resource: emitting resource changed " << endl; - mResourceChangedTimer.stop(); - emit resourceChanged( this ); -} - -KABC::Lock* ResourceScalix::lock() -{ - return new KABC::LockNull( true ); -} - - -Scalix::ResourceMap* ResourceScalix::subResourceMap( const TQString& contentsType ) -{ - if ( contentsType == kmailCalendarContentsType ) { - return &mEventSubResources; - } else if ( contentsType == kmailTodoContentsType ) { - return &mTodoSubResources; - } else if ( contentsType == kmailJournalContentsType ) { - return &mJournalSubResources; - } - // Not ours - return 0; -} - -#include "resourcescalix.moc" diff --git a/kresources/scalix/kcal/resourcescalix.h b/kresources/scalix/kcal/resourcescalix.h deleted file mode 100644 index dcd783979..000000000 --- a/kresources/scalix/kcal/resourcescalix.h +++ /dev/null @@ -1,225 +0,0 @@ -/* - This file is part of the scalix resource - based on the kolab resource. - - Copyright (c) 2004 Bo Thorsen - 2004 Till Adam - - This library 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 of the License, or (at your option) any later version. - - This library 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 library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef KCAL_RESOURCESCALIX_H -#define KCAL_RESOURCESCALIX_H - -#include - -#include -#include -#include -#include -#include "../shared/resourcescalixbase.h" - -namespace KCal { - -struct TemporarySilencer; - -class KDE_EXPORT ResourceScalix : public KCal::ResourceCalendar, - public KCal::IncidenceBase::Observer, - public Scalix::ResourceScalixBase -{ - Q_OBJECT - - friend struct TemporarySilencer; - -public: - ResourceScalix( const TDEConfig* ); - virtual ~ResourceScalix(); - - /// Load resource data. - bool doLoad(); - - /// Save resource data. - bool doSave(); - - /// Open the notes resource. - bool doOpen(); - /// Close the notes resource. - void doClose(); - - // The libkcal functions. See the resource for descriptions - bool addEvent( KCal::Event* anEvent ); - bool addEvent( KCal::Event* anEvent, const TQString &subresource ); - bool deleteEvent( KCal::Event* ); - KCal::Event* event( const TQString &UniqueStr ); - KCal::Event::List rawEvents( EventSortField sortField = EventSortUnsorted, SortDirection sortDirection = SortDirectionAscending ); - KCal::Event::List rawEventsForDate( - const TQDate& date, - EventSortField sortField=EventSortUnsorted, - SortDirection sortDirection=SortDirectionAscending ); - KCal::Event::List rawEventsForDate( const TQDateTime& qdt ); - KCal::Event::List rawEvents( const TQDate& start, const TQDate& end, - bool inclusive = false ); - - bool addTodo( KCal::Todo* todo ); - bool addTodo( KCal::Todo* todo, const TQString &subresource ); - bool deleteTodo( KCal::Todo* ); - KCal::Todo* todo( const TQString& uid ); - KCal::Todo::List rawTodos( TodoSortField sortField = TodoSortUnsorted, SortDirection sortDirection = SortDirectionAscending ); - KCal::Todo::List rawTodosForDate( const TQDate& date ); - - bool addJournal( KCal::Journal* ); - bool addJournal( KCal::Journal* journal, const TQString &subresource ); - bool deleteJournal( KCal::Journal* ); - KCal::Journal* journal( const TQString& uid ); - KCal::Journal::List rawJournals( JournalSortField sortField = JournalSortUnsorted, SortDirection sortDirection = SortDirectionAscending ); - KCal::Journal::List rawJournalsForDate( const TQDate &date ); - - KCal::Alarm::List alarms( const TQDateTime& from, const TQDateTime& to ); - KCal::Alarm::List alarmsTo( const TQDateTime& to ); - - void setTimeZoneId( const TQString& tzid ); - - bool deleteIncidence( KCal::Incidence* i ); - - /// The ResourceScalixBase methods called by KMail - bool fromKMailAddIncidence( const TQString& type, const TQString& subResource, - TQ_UINT32 sernum, int format, const TQString& data ); - void fromKMailDelIncidence( const TQString& type, const TQString& subResource, - const TQString& uid ); - void fromKMailRefresh( const TQString& type, const TQString& subResource ); - - /// Listen to KMail changes in the amount of sub resources - void fromKMailAddSubresource( const TQString& type, const TQString& subResource, - const TQString& label, bool writable ); - void fromKMailDelSubresource( const TQString& type, const TQString& subResource ); - - void fromKMailAsyncLoadResult( const TQMap& map, - const TQString& type, - const TQString& folder ); - - /** Return the list of subresources. */ - TQStringList subresources() const; - - /** Is this subresource active? */ - bool subresourceActive( const TQString& ) const; - /** (De)activate the subresource */ - virtual void setSubresourceActive( const TQString &, bool ); - - /** What is the label for this subresource? */ - virtual const TQString labelForSubresource( const TQString& resource ) const; - - virtual TQString subresourceIdentifier( Incidence *incidence ); - - KABC::Lock* lock(); - -signals: - void useGlobalMode(); -protected slots: - void slotEmitResourceChanged(); - -private: - void removeIncidences( const TQCString& incidenceType ); - void resolveConflict( KCal::Incidence*, const TQString& subresource, TQ_UINT32 sernum ); - - void addIncidence( const char* mimetype, const TQString& xml, - const TQString& subResource, TQ_UINT32 sernum ); - - bool addIncidence( KCal::Incidence* i, const TQString& subresource, - TQ_UINT32 sernum ); -/* - void addEvent( const TQString& xml, const TQString& subresource, - TQ_UINT32 sernum ); - void addTodo( const TQString& xml, const TQString& subresource, - TQ_UINT32 sernum ); - void addJournal( const TQString& xml, const TQString& subresource, - TQ_UINT32 sernum ); -*/ - - bool loadAllEvents(); - bool loadAllTodos(); - bool loadAllJournals(); - - bool doLoadAll( Scalix::ResourceMap& map, const char* mimetype ); - - /// Reimplemented from IncidenceBase::Observer to know when an incidence was changed - void incidenceUpdated( KCal::IncidenceBase* ); - - bool openResource( TDEConfig& config, const char* contentType, - Scalix::ResourceMap& map ); - void loadSubResourceConfig( TDEConfig& config, const TQString& name, - const TQString& label, bool writable, - Scalix::ResourceMap& subResource ); - bool loadSubResource( const TQString& subResource, const char* mimetype ); - - TQString configFile() const { - return ResourceScalixBase::configFile( "kcal" ); - } - - Scalix::ResourceMap* subResourceMap( const TQString& contentsType ); - - bool sendKMailUpdate( KCal::IncidenceBase* incidence, const TQString& _subresource, - TQ_UINT32 sernum ); - - - KCal::CalendarLocal mCalendar; - - // The list of subresources - Scalix::ResourceMap mEventSubResources, mTodoSubResources, mJournalSubResources; - - bool mOpen; // If the resource is open, this is true - TQDict mPendingUpdates; - TQTimer mResourceChangedTimer; - ICalFormat mFormat; - - /** - This map contains the association between a new added incidence - and the subresource it belongs to. - That's needed to return the correct mapping in subresourceIdentifier(). - - We can't trust on mUidMap here, because it contains only non-pending uids. - */ - TQMap mNewIncidencesMap; - int mProgressDialogIncidenceLimit; -}; - -struct TemporarySilencer { - TemporarySilencer( ResourceScalix *_resource ) - { - resource = _resource; - oldValue = resource->mSilent; - resource->mSilent = true; - } - ~TemporarySilencer() - { - resource->mSilent = oldValue; - } - ResourceScalix *resource; - bool oldValue; -}; - -} - -#endif // KCAL_RESOURCESCALIX_H diff --git a/kresources/scalix/kcal/resourcescalix_plugin.cpp b/kresources/scalix/kcal/resourcescalix_plugin.cpp deleted file mode 100644 index 036c2f45e..000000000 --- a/kresources/scalix/kcal/resourcescalix_plugin.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - This file is part of the scalix resource - based on the kolab resource. - - Copyright (c) 2002 - 2004 Klarlvdalens Datakonsult AB - - - This library 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 of the License, or (at your option) any later version. - - This library 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 library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include "resourcescalix.h" - -class ScalixFactory : public KRES::PluginFactoryBase -{ -public: - KRES::Resource *resource( const TDEConfig *config ) - { - return new KCal::ResourceScalix( config ); - } - - KRES::ConfigWidget *configWidget( TQWidget* ) - { - return 0; - } -}; - -K_EXPORT_COMPONENT_FACTORY(kcal_scalix,ScalixFactory) diff --git a/kresources/scalix/kcal/scalix.desktop b/kresources/scalix/kcal/scalix.desktop deleted file mode 100644 index 06c5c8187..000000000 --- a/kresources/scalix/kcal/scalix.desktop +++ /dev/null @@ -1,31 +0,0 @@ -[Desktop Entry] -Name=Calendar on Scalix Server via KMail -Name[bg]=Календар на сървъра Scalix през KMail -Name[ca]=Calendari en un servidor Scalix mitjançant el KMail -Name[da]=Kalender på Scalix-server via KMail -Name[de]=Kalender auf einem Scalix-Server via KMail -Name[el]=Ημερολόγιο σε εξυπηρετητή Scalix μέσω του KMail -Name[es]=Calendario en servidor Scalix por medio de KMail -Name[et]=Kalender Scalix-serveris (KMaili vahendusel) -Name[fr]=Agenda sur serveur Scalix via KMail -Name[is]=Dagatal á Scalix-þjóni gegnum KMail -Name[it]=Calendario su server Scalix via KMail -Name[ja]=KMail 経由 Scalix サーバのカレンダー -Name[km]=ប្រតិទិន​នៅ​លើ​ម៉ាស៊ីន​បម្រើ Scalix តាម​រយៈ KMail -Name[nds]=Kalenner op Scalix-Server över KMail -Name[nl]=Agenda op Scalix-server via KMail -Name[pl]=Kalendarz na serwerze Scalix za pośrednictwem KMaila -Name[pt_BR]=Calendário em Servidor Scalix via KMail -Name[ru]=Календарь на сервере Scalix через KMail -Name[sk]=Kalendár na Scalix serveri pomocou KMail -Name[sr]=Календар на Scalix серверу преко KMail-а -Name[sr@Latn]=Kalendar na Scalix serveru preko KMail-a -Name[sv]=Kalender på Scalix-server via Kmail -Name[tr]=KMail Aracılığı ile Scalix Sunucusunda Takvim -Name[zh_CN]=通过 KMail 访问 Scalix 服务器上的日历 -Name[zh_TW]=透過 KMail 取得 Scalix 伺服器上的行事曆 -X-TDE-Library=kcal_scalix -Type=Service -ServiceTypes=KResources/Plugin -X-TDE-ResourceFamily=calendar -X-TDE-ResourceType=scalix diff --git a/kresources/scalix/kioslave/CMakeLists.txt b/kresources/scalix/kioslave/CMakeLists.txt deleted file mode 100644 index 7ba76f672..000000000 --- a/kresources/scalix/kioslave/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_SOURCE_DIR}/libtdepim - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -##### other data ################################ - -install( - FILES scalix.protocol scalixs.protocol - DESTINATION ${SERVICES_INSTALL_DIR} ) - - -##### kio_scalix (module) ####################### - -tde_add_kpart( kio_scalix AUTOMOC - SOURCES scalix.cpp - LINK tdepim-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/kresources/scalix/kioslave/Makefile.am b/kresources/scalix/kioslave/Makefile.am deleted file mode 100644 index 5607fb9d7..000000000 --- a/kresources/scalix/kioslave/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -INCLUDES = -I$(top_srcdir) -I$(top_builddir)/libtdepim $(all_includes) - -noinst_HEADERS = scalix.h - -METASOURCES = AUTO - -kdelnkdir = $(kde_servicesdir) -kdelnk_DATA = scalix.protocol scalixs.protocol - -kde_module_LTLIBRARIES = kio_scalix.la - -kio_scalix_la_SOURCES = scalix.cpp -kio_scalix_la_LIBADD = $(top_builddir)/libkcal/libkcal.la $(top_builddir)/libtdepim/libtdepim.la $(LIB_KIO) -kio_scalix_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) - -messages: rc.cpp - $(XGETTEXT) *.cpp -o $(podir)/kio_scalix.pot diff --git a/kresources/scalix/kioslave/scalix.cpp b/kresources/scalix/kioslave/scalix.cpp deleted file mode 100644 index 1b4cc7b8f..000000000 --- a/kresources/scalix/kioslave/scalix.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/* - This file is part of KDE. - - Copyright (C) 2007 Trolltech ASA. All rights reserved. - - 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 -#include - -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include "scalix.h" - -extern "C" { - KDE_EXPORT int kdemain( int argc, char **argv ); -} - -static const KCmdLineOptions options[] = -{ - { "+protocol", I18N_NOOP( "Protocol name" ), 0 }, - { "+pool", I18N_NOOP( "Socket name" ), 0 }, - { "+app", I18N_NOOP( "Socket name" ), 0 }, - KCmdLineLastOption -}; - -int kdemain( int argc, char **argv ) -{ - putenv( strdup( "SESSION_MANAGER=" ) ); - TDEApplication::disableAutoDcopRegistration(); - - TDECmdLineArgs::init( argc, argv, "kio_scalix", 0, 0, 0, 0 ); - TDECmdLineArgs::addCmdLineOptions( options ); - TDEApplication app( false, false ); - - TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); - Scalix slave( args->arg( 0 ), args->arg( 1 ), args->arg( 2 ) ); - slave.dispatchLoop(); - - return 0; -} - -Scalix::Scalix( const TQCString &protocol, const TQCString &pool, const TQCString &app ) - : SlaveBase( protocol, pool, app ) -{ -} - -void Scalix::get( const KURL &url ) -{ - mimeType( "text/plain" ); - - TQString path = url.path(); - - if ( path.contains( "/freebusy/" ) ) { - retrieveFreeBusy( url ); - } else { - error( TDEIO::ERR_SLAVE_DEFINED, i18n( "Unknown path. Known path is '/freebusy/'" ) ); - } -} - -void Scalix::put( const KURL& url, int, bool, bool ) -{ - TQString path = url.path(); - - if ( path.contains( "/freebusy/" ) ) { - publishFreeBusy( url ); - } else { - error( TDEIO::ERR_SLAVE_DEFINED, i18n( "Unknown path. Known path is '/freebusy/'" ) ); - } -} - -void Scalix::retrieveFreeBusy( const KURL &url ) -{ - /** - * The url is of the following form: - * scalix://user:password@host/freebusy/user@domain.ifb - */ - - // Extract user@domain (e.g. everything between '/freebusy/' and '.ifb') - const TQString requestUser = url.path().mid( 10, url.path().length() - 14 ); - - TQByteArray packedArgs; - TQDataStream stream( packedArgs, IO_WriteOnly ); - - const TQString argument = TQString( "BEGIN:VFREEBUSY\nATTENDEE:MAILTO:%1\nEND:VFREEBUSY" ).arg( requestUser ); - const TQString command = TQString( "X-GET-ICAL-FREEBUSY {%1}" ).arg( argument.length() ); - - stream << (int) 'X' << 'E' << command << argument; - - TQString imapUrl = TQString( "imap://%1@%3/" ).arg( url.pass().isEmpty() ? - url.user() : url.user() + ":" + url.pass() ) - .arg( url.host() ); - - mFreeBusyData = TQString(); - - TDEIO::SimpleJob *job = TDEIO::special( imapUrl, packedArgs, false ); - connect( job, TQT_SIGNAL( infoMessage( TDEIO::Job*, const TQString& ) ), - this, TQT_SLOT( slotInfoMessage( TDEIO::Job*, const TQString& ) ) ); - connect( job, TQT_SIGNAL( result( TDEIO::Job* ) ), - this, TQT_SLOT( slotRetrieveResult( TDEIO::Job* ) ) ); - - tqApp->eventLoop()->enterLoop(); -} - -void Scalix::publishFreeBusy( const KURL &url ) -{ - /** - * The url is of the following form: - * scalix://user:password@host/freebusy/path/to/calendar/user@domain - */ - TQString requestUser, calendar; - TQString path = url.path(); - - // extract user name - int lastSlash = path.findRev( '/' ); - if ( lastSlash != -1 ) - requestUser = path.mid( lastSlash + 1 ); - - // extract calendar name - int secondSlash = path.find( '/', 1 ); - if ( secondSlash != -1 ) - calendar = path.mid( secondSlash + 1, lastSlash - secondSlash - 1 ); - - if ( requestUser.isEmpty() || calendar.isEmpty() ) { - error( TDEIO::ERR_SLAVE_DEFINED, i18n( "No user or calendar given!" ) ); - return; - }; - - // read freebusy information - TQByteArray data; - while ( true ) { - dataReq(); - - TQByteArray buffer; - const int newSize = readData(buffer); - if ( newSize < 0 ) { - // read error: network in unknown state so disconnect - error( TDEIO::ERR_COULD_NOT_READ, i18n("KIO data supply error.") ); - return; - } - - if ( newSize == 0 ) - break; - - unsigned int oldSize = data.size(); - data.resize( oldSize + buffer.size() ); - memcpy( data.data() + oldSize, buffer.data(), buffer.size() ); - } - - TQByteArray packedArgs; - TQDataStream stream( packedArgs, IO_WriteOnly ); - - const TQString argument = TQString::fromUtf8( data ); - const TQString command = TQString( "X-PUT-ICAL-FREEBUSY Calendar {%1}" ).arg( argument.length() ); - - stream << (int) 'X' << 'E' << command << argument; - - TQString imapUrl = TQString( "imap://%1@%3/" ).arg( url.pass().isEmpty() ? - url.user() : url.user() + ":" + url.pass() ) - .arg( url.host() ); - - TDEIO::SimpleJob *job = TDEIO::special( imapUrl, packedArgs, false ); - connect( job, TQT_SIGNAL( result( TDEIO::Job* ) ), - this, TQT_SLOT( slotPublishResult( TDEIO::Job* ) ) ); - - tqApp->eventLoop()->enterLoop(); -} - -void Scalix::slotInfoMessage( TDEIO::Job *job, const TQString &data ) -{ - if ( job->error() ) { - // error is handled in slotResult - return; - } - - mFreeBusyData = data; -} - - -void Scalix::slotRetrieveResult( TDEIO::Job *job ) -{ - if ( job->error() ) { - error( TDEIO::ERR_SLAVE_DEFINED, job->errorString() ); - } else { - data( mFreeBusyData.utf8() ); - finished(); - } - - tqApp->eventLoop()->exitLoop(); -} - -void Scalix::slotPublishResult( TDEIO::Job *job ) -{ - if ( job->error() ) { - error( TDEIO::ERR_SLAVE_DEFINED, job->errorString() ); - } else { - finished(); - } - - tqApp->eventLoop()->exitLoop(); -} - -#include "scalix.moc" diff --git a/kresources/scalix/kioslave/scalix.h b/kresources/scalix/kioslave/scalix.h deleted file mode 100644 index dc034b7b5..000000000 --- a/kresources/scalix/kioslave/scalix.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - This file is part of KDE. - - Copyright (C) 2007 Trolltech ASA. All rights reserved. - - 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 SCALIX_H -#define SCALIX_H - -#include -#include - -#include - -class Scalix : public TQObject, public TDEIO::SlaveBase -{ - Q_OBJECT - - - public: - Scalix( const TQCString &protocol, const TQCString &pool, const TQCString &app ); - - void get( const KURL &url ); - void put( const KURL &url, int permissions, bool overwrite, bool resume ); - - private slots: - void slotRetrieveResult( TDEIO::Job* ); - void slotPublishResult( TDEIO::Job* ); - void slotInfoMessage( TDEIO::Job*, const TQString& ); - - private: - void retrieveFreeBusy( const KURL& ); - void publishFreeBusy( const KURL& ); - - TQString mFreeBusyData; -}; - -#endif diff --git a/kresources/scalix/kioslave/scalix.protocol b/kresources/scalix/kioslave/scalix.protocol deleted file mode 100644 index a527d77dd..000000000 --- a/kresources/scalix/kioslave/scalix.protocol +++ /dev/null @@ -1,8 +0,0 @@ -[Protocol] -DocPath=kioslave/scalix.html -exec=kio_scalix -input=none -output=filesystem -protocol=scalix -reading=true -writing=true diff --git a/kresources/scalix/kioslave/scalixs.protocol b/kresources/scalix/kioslave/scalixs.protocol deleted file mode 100644 index fd13db6ad..000000000 --- a/kresources/scalix/kioslave/scalixs.protocol +++ /dev/null @@ -1,8 +0,0 @@ -[Protocol] -DocPath=kioslave/scalix.html -exec=kio_scalix -input=none -output=filesystem -protocol=scalixs -reading=true -writing=true diff --git a/kresources/scalix/knotes/CMakeLists.txt b/kresources/scalix/knotes/CMakeLists.txt deleted file mode 100644 index 516690e05..000000000 --- a/kresources/scalix/knotes/CMakeLists.txt +++ /dev/null @@ -1,56 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_SOURCE_DIR} - ${CMAKE_SOURCE_DIR}/knotes - ${CMAKE_SOURCE_DIR}/libtdepim - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -##### other data ################################ - -# FIXME this is a conflict - -install( - FILES scalix.desktop - DESTINATION ${SERVICES_INSTALL_DIR}/kresources/knotes ) - -install( - FILES ../uninstall.desktop - RENAME scalix.desktop - DESTINATION ${SERVICES_INSTALL_DIR}/kresources/knotes ) - - -##### knotes_scalix (module) #################### - -tde_add_kpart( knotes_scalix AUTOMOC - SOURCES resourcescalix_plugin.cpp - LINK knotesscalix-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) - - -##### knotesscalix (shared) ##################### - -tde_add_library( knotesscalix SHARED AUTOMOC - SOURCES resourcescalix.cpp - VERSION 0.0.0 - LINK resourcescalixshared-static kgroupwarebase-shared knotes-shared - DESTINATION ${LIB_INSTALL_DIR} -) diff --git a/kresources/scalix/knotes/Makefile.am b/kresources/scalix/knotes/Makefile.am deleted file mode 100644 index 56d7efe3e..000000000 --- a/kresources/scalix/knotes/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ -METASOURCES = AUTO - -INCLUDES = -I$(top_srcdir)/kresources/scalix/shared \ - -I$(top_srcdir) -I$(top_srcdir)/knotes -I$(top_builddir)/libtdepim $(all_includes) - -# The scalix wizard links to this library too -lib_LTLIBRARIES = libknotesscalix.la - -libknotesscalix_la_SOURCES = resourcescalix.cpp -libknotesscalix_la_LDFLAGS = $(all_libraries) -no-undefined -libknotesscalix_la_LIBADD = \ - $(top_builddir)/kresources/scalix/shared/libresourcescalixshared.la \ - $(top_builddir)/knotes/libknotesresources.la \ - $(top_builddir)/libkcal/libkcal.la \ - -lkresources -ltdeprint - -kde_module_LTLIBRARIES = knotes_scalix.la - -knotes_scalix_la_SOURCES = resourcescalix_plugin.cpp -knotes_scalix_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -no-undefined -knotes_scalix_la_LIBADD = libknotesscalix.la - -servicedir = $(kde_servicesdir)/kresources/knotes -service_DATA = scalix.desktop - -install-data-local: $(srcdir)/../uninstall.desktop - $(mkinstalldirs) $(DESTDIR)$(servicedir) - $(INSTALL_DATA) $(srcdir)/../uninstall.desktop $(DESTDIR)$(servicedir)/scalix.desktop diff --git a/kresources/scalix/knotes/resourcescalix.cpp b/kresources/scalix/knotes/resourcescalix.cpp deleted file mode 100644 index 62b0daf48..000000000 --- a/kresources/scalix/knotes/resourcescalix.cpp +++ /dev/null @@ -1,425 +0,0 @@ -/* - This file is part of the scalix resource - based on the kolab resource. - - Copyright (c) 2004 Bo Thorsen - Copyright (c) 2004 Till Adam - - This library 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 of the License, or (at your option) any later version. - - This library 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 library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include "resourcescalix.h" - -#include - -#include - -#include -#include - -using namespace Scalix; - -static const char* configGroupName = "Note"; -static const char* kmailContentsType = "Note"; -static const char* attachmentMimeType = "application/x-vnd.kolab.note"; -static const char* inlineMimeType = "text/calendar"; - -ResourceScalix::ResourceScalix( const TDEConfig *config ) - : ResourceNotes( config ), ResourceScalixBase( "ResourceScalix-KNotes" ), - mCalendar( TQString::fromLatin1("UTC") ) -{ - setType( "scalix" ); -} - -ResourceScalix::~ResourceScalix() -{ -} - -bool ResourceScalix::doOpen() -{ - TDEConfig config( configFile() ); - config.setGroup( configGroupName ); - - // Get the list of Notes folders from KMail - TQValueList subResources; - if ( !kmailSubresources( subResources, kmailContentsType ) ) - return false; - - // Make the resource map from the folder list - TQValueList::ConstIterator it; - mSubResources.clear(); - for ( it = subResources.begin(); it != subResources.end(); ++it ) { - const TQString subResource = (*it).location; - const bool active = config.readBoolEntry( subResource, true ); - mSubResources[ subResource ] = Scalix::SubResource( active, (*it).writable, (*it).label ); - } - - return true; -} - -void ResourceScalix::doClose() -{ - TDEConfig config( configFile() ); - config.setGroup( configGroupName ); - Scalix::ResourceMap::ConstIterator it; - for ( it = mSubResources.begin(); it != mSubResources.end(); ++it ) - config.writeEntry( it.key(), it.data().active() ); -} - -bool ResourceScalix::loadSubResource( const TQString& subResource, - const TQString &mimetype ) -{ - // Get the list of journals - int count = 0; - if ( !kmailIncidencesCount( count, mimetype, subResource ) ) { - kdError() << "Communication problem in ResourceScalix::load()\n"; - return false; - } - - TQMap lst; - if( !kmailIncidences( lst, mimetype, subResource, 0, count ) ) { - kdError(5500) << "Communication problem in " - << "ResourceScalix::getIncidenceList()\n"; - return false; - } - - kdDebug(5500) << "Notes scalix resource: got " << lst.count() << " notes in " << subResource << endl; - - // Populate with the new entries - const bool silent = mSilent; - mSilent = true; - TQMap::Iterator it; - for ( it = lst.begin(); it != lst.end(); ++it ) { - KCal::Journal* journal = addNote( it.data(), subResource, it.key(), mimetype ); - if ( !journal ) - kdDebug(5500) << "loading note " << it.key() << " failed" << endl; - else - manager()->registerNote( this, journal ); - } - mSilent = silent; - - return true; -} - -bool ResourceScalix::load() -{ - // We get a fresh list of events, so clean out the old ones - mCalendar.deleteAllEvents(); - mUidMap.clear(); - - bool rc = true; - Scalix::ResourceMap::ConstIterator itR; - for ( itR = mSubResources.begin(); itR != mSubResources.end(); ++itR ) { - if ( !itR.data().active() ) - // This subResource is disabled - continue; - - TQString mimetype = inlineMimeType; - rc &= loadSubResource( itR.key(), mimetype ); - mimetype = attachmentMimeType; - rc &= loadSubResource( itR.key(), mimetype ); - } - - return rc; -} - -bool ResourceScalix::save() -{ - // Nothing to do here, we save everything in incidenceUpdated() - return true; -} - -bool ResourceScalix::addNote( KCal::Journal* journal ) -{ - return addNote( journal, TQString(), 0 ); -} - -KCal::Journal* ResourceScalix::addNote( const TQString& data, const TQString& subresource, - TQ_UINT32 sernum, const TQString& ) -{ - KCal::Journal* journal = 0; - // FIXME: This does not take into account the time zone! - KCal::ICalFormat formatter; - journal = static_cast( formatter.fromString( data ) ); - - Q_ASSERT( journal ); - if( journal && !mUidMap.contains( journal->uid() ) ) - if ( addNote( journal, subresource, sernum ) ) - return journal; - else - delete journal; - return 0; -} - -bool ResourceScalix::addNote( KCal::Journal* journal, - const TQString& subresource, TQ_UINT32 sernum ) -{ - kdDebug(5500) << "ResourceScalix::addNote( KCal::Journal*, '" << subresource << "', " << sernum << " )\n"; - - journal->registerObserver( this ); - - // Find out if this note was previously stored in KMail - bool newNote = subresource.isEmpty(); - mCalendar.addJournal( journal ); - - TQString resource = - newNote ? findWritableResource( mSubResources ) : subresource; - if ( resource.isEmpty() ) // canceled - return false; - - if ( !mSilent ) { - KCal::ICalFormat formatter; - const TQString xml = formatter.toString( journal ); - kdDebug(5500) << k_funcinfo << "XML string:\n" << xml << endl; - - if( !kmailUpdate( resource, sernum, xml, attachmentMimeType, journal->uid() ) ) { - kdError(5500) << "Communication problem in ResourceScalix::addNote()\n"; - return false; - } - } - - if ( !resource.isEmpty() && sernum != 0 ) { - mUidMap[ journal->uid() ] = StorageReference( resource, sernum ); - return true; - } - - return false; -} - -bool ResourceScalix::deleteNote( KCal::Journal* journal ) -{ - const TQString uid = journal->uid(); - if ( !mUidMap.contains( uid ) ) - // Odd - return false; - - if ( !mSilent ) { - kmailDeleteIncidence( mUidMap[ uid ].resource(), - mUidMap[ uid ].serialNumber() ); - } - mUidMap.remove( uid ); - manager()->deleteNote( journal ); - mCalendar.deleteJournal( journal ); - return true; -} - -KCal::Alarm::List ResourceScalix::alarms( const TQDateTime& from, const TQDateTime& to ) -{ - KCal::Alarm::List alarms; - KCal::Journal::List notes = mCalendar.journals(); - KCal::Journal::List::ConstIterator note; - for ( note = notes.begin(); note != notes.end(); ++note ) - { - TQDateTime preTime = from.addSecs( -1 ); - KCal::Alarm::List::ConstIterator it; - for( it = (*note)->alarms().begin(); it != (*note)->alarms().end(); ++it ) - { - if ( (*it)->enabled() ) - { - TQDateTime dt = (*it)->nextRepetition( preTime ); - if ( dt.isValid() && dt <= to ) - alarms.append( *it ); - } - } - } - - return alarms; -} - -void ResourceScalix::incidenceUpdated( KCal::IncidenceBase* i ) -{ - TQString subResource; - TQ_UINT32 sernum; - if ( mUidMap.contains( i->uid() ) ) { - subResource = mUidMap[ i->uid() ].resource(); - sernum = mUidMap[ i->uid() ].serialNumber(); - } else { // can this happen? - subResource = findWritableResource( mSubResources ); - if ( subResource.isEmpty() ) // canceled - return; - sernum = 0; - } - - KCal::Journal* journal = dynamic_cast( i ); - KCal::ICalFormat formatter; - const TQString xml = formatter.toString( journal ); - if( !xml.isEmpty() && kmailUpdate( subResource, sernum, xml, attachmentMimeType, journal->uid() ) ) - mUidMap[ i->uid() ] = StorageReference( subResource, sernum ); -} - -/* - * These are the DCOP slots that KMail call to notify when something - * changed. - */ -bool ResourceScalix::fromKMailAddIncidence( const TQString& type, - const TQString& subResource, - TQ_UINT32 sernum, - int, - const TQString& note ) -{ - // Check if this is a note - if( type != kmailContentsType ) return false; - - const bool silent = mSilent; - mSilent = true; - TQString mimetype = inlineMimeType; - KCal::Journal* journal = addNote( note, subResource, sernum, mimetype ); - if ( journal ) - manager()->registerNote( this, journal ); - mSilent = silent; - return true; -} - -void ResourceScalix::fromKMailDelIncidence( const TQString& type, - const TQString& /*subResource*/, - const TQString& uid ) -{ - // Check if this is a note - if( type != kmailContentsType ) return; - - kdDebug(5500) << "ResourceScalix::fromKMailDelIncidence( " << type << ", " << uid - << " )" << endl; - - const bool silent = mSilent; - mSilent = true; - KCal::Journal* j = mCalendar.journal( uid ); - if( j ) - deleteNote( j ); - mSilent = silent; -} - -void ResourceScalix::fromKMailRefresh( const TQString& type, - const TQString& /*subResource*/ ) -{ - if ( type == kmailContentsType ) - load(); // ### should call loadSubResource(subResource) probably -} - -void ResourceScalix::fromKMailAddSubresource( const TQString& type, - const TQString& subResource, - const TQString& mimetype, - bool writable ) -{ - if ( type != kmailContentsType ) - // Not ours - return; - - if ( mSubResources.contains( subResource ) ) - // Already registered - return; - - TDEConfig config( configFile() ); - config.setGroup( configGroupName ); - - bool active = config.readBoolEntry( subResource, true ); - mSubResources[ subResource ] = Scalix::SubResource( active, writable, subResource ); - loadSubResource( subResource, mimetype ); - emit signalSubresourceAdded( this, type, subResource ); -} - -void ResourceScalix::fromKMailDelSubresource( const TQString& type, - const TQString& subResource ) -{ - if ( type != configGroupName ) - // Not ours - return; - - if ( !mSubResources.contains( subResource ) ) - // Not registered - return; - - // Ok, it's our job, and we have it here - mSubResources.erase( subResource ); - - TDEConfig config( configFile() ); - config.setGroup( configGroupName ); - config.deleteEntry( subResource ); - config.sync(); - - // Make a list of all uids to remove - Scalix::UidMap::ConstIterator mapIt; - TQStringList uids; - for ( mapIt = mUidMap.begin(); mapIt != mUidMap.end(); ++mapIt ) - if ( mapIt.data().resource() == subResource ) - // We have a match - uids << mapIt.key(); - - // Finally delete all the incidences - if ( !uids.isEmpty() ) { - const bool silent = mSilent; - mSilent = true; - TQStringList::ConstIterator it; - for ( it = uids.begin(); it != uids.end(); ++it ) { - KCal::Journal* j = mCalendar.journal( *it ); - if( j ) - deleteNote( j ); - } - mSilent = silent; - } - - emit signalSubresourceRemoved( this, type, subResource ); -} - -void ResourceScalix::fromKMailAsyncLoadResult( const TQMap& map, - const TQString& type, - const TQString& folder ) -{ - // We are only interested in notes - if ( ( type != attachmentMimeType ) && ( type != inlineMimeType ) ) return; - // Populate with the new entries - const bool silent = mSilent; - mSilent = true; - TQString mimetype = inlineMimeType; - for( TQMap::ConstIterator it = map.begin(); it != map.end(); ++it ) { - KCal::Journal* journal = addNote( it.data(), folder, it.key(), mimetype ); - if ( !journal ) - kdDebug(5500) << "loading note " << it.key() << " failed" << endl; - else - manager()->registerNote( this, journal ); - } - mSilent = silent; -} - - -TQStringList ResourceScalix::subresources() const -{ - return mSubResources.keys(); -} - -bool ResourceScalix::subresourceActive( const TQString& res ) const -{ - if ( mSubResources.contains( res ) ) { - return mSubResources[ res ].active(); - } - - // Safe default bet: - kdDebug(5650) << "subresourceActive( " << res << " ): Safe bet\n"; - - return true; -} - - -#include "resourcescalix.moc" diff --git a/kresources/scalix/knotes/resourcescalix.h b/kresources/scalix/knotes/resourcescalix.h deleted file mode 100644 index 6a3676c1e..000000000 --- a/kresources/scalix/knotes/resourcescalix.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - This file is part of the scalix resource - based on the kolab resource. - - Copyright (c) 2004 Bo Thorsen - - This library 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 of the License, or (at your option) any later version. - - This library 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 library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef KNOTES_RESOURCESCALIX_H -#define KNOTES_RESOURCESCALIX_H - -#include -#include -#include -#include "../shared/resourcescalixbase.h" -#include "../shared/subresource.h" -#include - - -namespace Scalix { - -/** - * This class implements a KNotes resource that keeps its - * addresses in an IMAP folder in KMail (or other conforming email - * clients). - */ -class KDE_EXPORT ResourceScalix : public ResourceNotes, - public KCal::IncidenceBase::Observer, - public ResourceScalixBase -{ - Q_OBJECT - - -public: - ResourceScalix( const TDEConfig* ); - virtual ~ResourceScalix(); - - /// Load resource data. - bool load(); - - /// Save resource data. - bool save(); - - /// Open the notes resource. - bool doOpen(); - /// Close the notes resource. - void doClose(); - - bool addNote( KCal::Journal* ); - - bool deleteNote( KCal::Journal* ); - - KCal::Alarm::List alarms( const TQDateTime& from, const TQDateTime& to ); - - /// Reimplemented from IncidenceBase::Observer to know when a note was changed - void incidenceUpdated( KCal::IncidenceBase* ); - - /// The ResourceScalixBase methods called by KMail - bool fromKMailAddIncidence( const TQString& type, const TQString& resource, - TQ_UINT32 sernum, int format, const TQString& note ); - void fromKMailDelIncidence( const TQString& type, const TQString& resource, - const TQString& uid ); - void fromKMailRefresh( const TQString& type, const TQString& resource ); - - /// Listen to KMail changes in the amount of sub resources - void fromKMailAddSubresource( const TQString& type, const TQString& resource, - const TQString& label, bool writable ); - void fromKMailDelSubresource( const TQString& type, const TQString& resource ); - - void fromKMailAsyncLoadResult( const TQMap& map, - const TQString& type, - const TQString& folder ); - - /** Return the list of subresources. */ - TQStringList subresources() const; - - /** Is this subresource active? */ - bool subresourceActive( const TQString& ) const; - -signals: - void signalSubresourceAdded( Resource*, const TQString&, const TQString& ); - void signalSubresourceRemoved( Resource*, const TQString&, const TQString& ); - -private: - bool addNote( KCal::Journal* journal, const TQString& resource, - TQ_UINT32 sernum ); - KCal::Journal* addNote( const TQString& data, const TQString& subresource, - TQ_UINT32 sernum, const TQString &mimetype ); - - bool loadSubResource( const TQString& resource, const TQString& mimetype ); - - TQString configFile() const { - return ResourceScalixBase::configFile( "knotes" ); - } - - KCal::CalendarLocal mCalendar; - - // The list of subresources - Scalix::ResourceMap mSubResources; -}; - -} - -#endif // KNOTES_RESOURCESCALIX_H diff --git a/kresources/scalix/knotes/resourcescalix_plugin.cpp b/kresources/scalix/knotes/resourcescalix_plugin.cpp deleted file mode 100644 index 925c27b01..000000000 --- a/kresources/scalix/knotes/resourcescalix_plugin.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - This file is part of the scalix resource - based on the kolab resource. - - Copyright (c) 2002 - 2004 Klarlvdalens Datakonsult AB - - - This library 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 of the License, or (at your option) any later version. - - This library 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 library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include "resourcescalix.h" - -class ScalixFactory : public KRES::PluginFactoryBase -{ -public: - KRES::Resource *resource( const TDEConfig *config ) - { - return new Scalix::ResourceScalix( config ); - } - - KRES::ConfigWidget *configWidget( TQWidget* ) - { - return 0; - } -}; - -K_EXPORT_COMPONENT_FACTORY( knotes_scalix, ScalixFactory() ) diff --git a/kresources/scalix/knotes/scalix.desktop b/kresources/scalix/knotes/scalix.desktop deleted file mode 100644 index 7669c7ae7..000000000 --- a/kresources/scalix/knotes/scalix.desktop +++ /dev/null @@ -1,30 +0,0 @@ -[Desktop Entry] -Name=Notes on Scalix Server via KMail -Name[bg]=Бележки на сървъра Scalix през KMail -Name[ca]=Notes en un servidor Scalix mitjançant el KMail -Name[da]=Noter på Scalix-server via KMail -Name[de]=Notizen auf einem Scalix-Server via KMail -Name[el]=Σημειώσεις σε εξυπηρετητή Scalix μέσω του KMail -Name[es]=Notas en servidor Scalix por medio de KMail -Name[et]=Kalender Scalix-serveris (KMaili vahendusel) -Name[fr]=Notes sur serveur Scalix via KMail -Name[is]=Minnismiðar á Scalix-þjóni gegnum KMail -Name[it]=Note su server Scalix via KMail -Name[ja]=KMail 経由 Scalix サーバのメモ -Name[km]=ចំណាំ​នៅលើ​ម៉ាស៊ីន​បម្រើ Scalix តាមរយៈ KMail -Name[nds]=Notizen op Scalix-Server över KMail -Name[nl]=Notities op Scalix-server via KMail -Name[pl]=Notatki na serwerze Scalix za pośrednictwem KMaila -Name[ru]=Заметки на сервере Scalix через KMail -Name[sk]=Poznámky na Scalix serveri pomocou KMail -Name[sr]=Белешке на Scalix серверу преко KMail-а -Name[sr@Latn]=Beleške na Scalix serveru preko KMail-a -Name[sv]=Anteckningar på Scalix-server via Kmail -Name[tr]=KMail Aracılığı ile Scalix Sunucusunda Takvim -Name[zh_CN]=通过 KMail 访问 Scalix 服务器上的日历 -Name[zh_TW]=透過 KMail 取得 Scalix 伺服器上的便條 -X-TDE-Library=knotes_scalix -Type=Service -ServiceTypes=KResources/Plugin -X-TDE-ResourceFamily=notes -X-TDE-ResourceType=scalix diff --git a/kresources/scalix/scalixadmin/CMakeLists.txt b/kresources/scalix/scalixadmin/CMakeLists.txt deleted file mode 100644 index f13d11a83..000000000 --- a/kresources/scalix/scalixadmin/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -##### scalixadmin (executable) ################## - -tde_add_executable( scalixadmin AUTOMOC - SOURCES - main.cpp mainwindow.cpp passwordpage.cpp settings.cpp jobs.cpp - otherusermanager.cpp otheruserview.cpp otheruserpage.cpp ldapview.cpp - ldapdialog.cpp delegatemanager.cpp delegateview.cpp delegatepage.cpp - delegatedialog.cpp outofofficepage.cpp - LINK kabc-shared - DESTINATION ${BIN_INSTALL_DIR} -) diff --git a/kresources/scalix/scalixadmin/Makefile.am b/kresources/scalix/scalixadmin/Makefile.am deleted file mode 100644 index 3ec92c4f6..000000000 --- a/kresources/scalix/scalixadmin/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -bin_PROGRAMS = scalixadmin - -INCLUDES = $(all_includes) - -scalixadmin_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor -scalixadmin_LDADD = $(LIB_KABC) -scalixadmin_SOURCES = main.cpp mainwindow.cpp passwordpage.cpp settings.cpp jobs.cpp \ - otherusermanager.cpp otheruserview.cpp otheruserpage.cpp ldapview.cpp ldapdialog.cpp \ - delegatemanager.cpp delegateview.cpp delegatepage.cpp delegatedialog.cpp \ - outofofficepage.cpp - -METASOURCES = AUTO - -messages: rc.cpp - $(XGETTEXT) *.cpp -o $(podir)/scalixadmin.pot diff --git a/kresources/scalix/scalixadmin/delegatedialog.cpp b/kresources/scalix/scalixadmin/delegatedialog.cpp deleted file mode 100644 index 661f57430..000000000 --- a/kresources/scalix/scalixadmin/delegatedialog.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 -#include -#include -#include -#include - -#include - -#include "jobs.h" -#include "ldapdialog.h" - -#include "delegatedialog.h" - -DelegateDialog::DelegateDialog( TQWidget *parent ) - : KDialogBase( parent, "", true, "", Ok | Cancel, Ok, true ) -{ - TQWidget *page = new TQWidget( this ); - TQGridLayout *layout = new TQGridLayout( page, 5, 3, 11, 6 ); - - TQLabel *label = new TQLabel( i18n( "User:" ), page ); - layout->addWidget( label, 0, 0 ); - - mEmail = new TQLineEdit( page ); - layout->addWidget( mEmail, 0, 1 ); - - TQToolButton *emailSelector = new TQToolButton( page ); - emailSelector->setUsesTextLabel( true ); - emailSelector->setTextLabel( i18n( "..." ) ); - layout->addWidget( emailSelector, 0, 2 ); - - TQValueList types; - types << Scalix::SendOnBehalfOf; - types << Scalix::SeePrivate; - types << Scalix::GetMeetings; - types << Scalix::InsteadOfMe; - - int row = 1; - for ( uint i = 0; i < types.count(); ++i ) { - TQCheckBox *box = new TQCheckBox( Scalix::Delegate::rightsAsString( types[ i ] ), page ); - layout->addMultiCellWidget( box, row, row, 1, 2 ); - - mRights.insert( types[ i ], box ); - row++; - } - - connect( emailSelector, TQT_SIGNAL( clicked() ), TQT_SLOT( selectEmail() ) ); - - setMainWidget( page ); -} - -void DelegateDialog::setDelegate( const Scalix::Delegate &delegate ) -{ - mEmail->setText( delegate.email() ); - - TQMap::Iterator it; - for ( it = mRights.begin(); it != mRights.end(); ++it ) - it.data()->setChecked( delegate.rights() & it.key() ); -} - -Scalix::Delegate DelegateDialog::delegate() const -{ - int rights = 0; - - TQMap::ConstIterator it; - for ( it = mRights.begin(); it != mRights.end(); ++it ) - if ( it.data()->isChecked() ) - rights |= it.key(); - - return Scalix::Delegate( mEmail->text(), rights ); -} - -void DelegateDialog::selectEmail() -{ - LdapDialog dlg( this ); - if ( !dlg.exec() ) - return; - - const TQString email = dlg.selectedUser(); - if ( email.isEmpty() ) - return; - - mEmail->setText( email ); -} - -#include "delegatedialog.moc" diff --git a/kresources/scalix/scalixadmin/delegatedialog.h b/kresources/scalix/scalixadmin/delegatedialog.h deleted file mode 100644 index 2f258113f..000000000 --- a/kresources/scalix/scalixadmin/delegatedialog.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 DELEGATEDIALOG_H -#define DELEGATEDIALOG_H - -#include - -#include - -class TQCheckBox; -class TQLineEdit; - -namespace Scalix { -class Delegate; -} - -class DelegateDialog : public KDialogBase -{ - Q_OBJECT - - - public: - DelegateDialog( TQWidget *parent = 0 ); - - void setDelegate( const Scalix::Delegate &delegate ); - Scalix::Delegate delegate() const; - - private slots: - void selectEmail(); - - private: - TQLineEdit *mEmail; - TQMap mRights; -}; - -#endif diff --git a/kresources/scalix/scalixadmin/delegatemanager.cpp b/kresources/scalix/scalixadmin/delegatemanager.cpp deleted file mode 100644 index 686370d77..000000000 --- a/kresources/scalix/scalixadmin/delegatemanager.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 "delegatemanager.h" - -DelegateManager::DelegateManager() -{ -} - -DelegateManager::~DelegateManager() -{ -} - -void DelegateManager::addDelegate( const Scalix::Delegate &delegate ) -{ - mDelegates.append( delegate ); - emit changed(); -} - -void DelegateManager::clear() -{ - mDelegates.clear(); - - emit changed(); -} - -Scalix::Delegate::List DelegateManager::delegates() const -{ - return mDelegates; -} - -#include "delegatemanager.moc" diff --git a/kresources/scalix/scalixadmin/delegatemanager.h b/kresources/scalix/scalixadmin/delegatemanager.h deleted file mode 100644 index 05b0262d8..000000000 --- a/kresources/scalix/scalixadmin/delegatemanager.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 DELEGATEMANAGER_H -#define DELEGATEMANAGER_H - -#include -#include - -#include "jobs.h" - -class DelegateManager : public TQObject -{ - Q_OBJECT - - - public: - DelegateManager(); - ~DelegateManager(); - - void addDelegate( const Scalix::Delegate &delegate ); - void clear(); - - Scalix::Delegate::List delegates() const; - - signals: - void changed(); - - private: - Scalix::Delegate::List mDelegates; -}; - -#endif diff --git a/kresources/scalix/scalixadmin/delegatepage.cpp b/kresources/scalix/scalixadmin/delegatepage.cpp deleted file mode 100644 index 169ff0853..000000000 --- a/kresources/scalix/scalixadmin/delegatepage.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 -#include - -#include -#include -#include - -#include - -#include "delegatedialog.h" -#include "delegateview.h" -#include "jobs.h" -#include "settings.h" - -#include "delegatepage.h" - -DelegatePage::DelegatePage( TQWidget *parent ) - : TQWidget( parent ) -{ - TQGridLayout *layout = new TQGridLayout( this, 2, 3, 11, 6 ); - - mView = new DelegateView( &mManager, this ); - layout->addMultiCellWidget( mView, 0, 0, 0, 2 ); - - mAddButton = new TQPushButton( i18n( "Add Delegate..." ), this ); - layout->addWidget( mAddButton, 1, 0 ); - - mEditButton = new TQPushButton( i18n( "Edit Delegate..." ), this ); - mEditButton->setEnabled( false ); - layout->addWidget( mEditButton, 1, 1 ); - - mRemoveButton = new TQPushButton( i18n( "Remove Delegate" ), this ); - mRemoveButton->setEnabled( false ); - layout->addWidget( mRemoveButton, 1, 2 ); - - connect( mView, TQT_SIGNAL( selectionChanged() ), TQT_SLOT( selectionChanged() ) ); - connect( mAddButton, TQT_SIGNAL( clicked() ), TQT_SLOT( addDelegate() ) ); - connect( mEditButton, TQT_SIGNAL( clicked() ), TQT_SLOT( editDelegate() ) ); - connect( mRemoveButton, TQT_SIGNAL( clicked() ), TQT_SLOT( removeDelegate() ) ); - - loadAllDelegates(); -} - -DelegatePage::~DelegatePage() -{ -} - -void DelegatePage::loadAllDelegates() -{ - Scalix::GetDelegatesJob *job = Scalix::getDelegates( Settings::self()->globalSlave(), - Settings::self()->accountUrl() ); - connect( job, TQT_SIGNAL( result( TDEIO::Job* ) ), TQT_SLOT( allDelegates( TDEIO::Job* ) ) ); -} - -void DelegatePage::addDelegate() -{ - DelegateDialog dlg( this ); - dlg.setCaption( i18n( "Add Delegate" ) ); - - if ( !dlg.exec() ) - return; - - const Scalix::Delegate delegate = dlg.delegate(); - - if ( !delegate.isValid() ) - return; - - Scalix::SetDelegateJob *job = Scalix::setDelegate( Settings::self()->globalSlave(), - Settings::self()->accountUrl(), - delegate.email(), delegate.rights() ); - connect( job, TQT_SIGNAL( result( TDEIO::Job* ) ), TQT_SLOT( delegateAdded( TDEIO::Job* ) ) ); -} - -void DelegatePage::editDelegate() -{ - const Scalix::Delegate oldDelegate = mView->selectedDelegate(); - if ( !oldDelegate.isValid() ) - return; - - DelegateDialog dlg( this ); - dlg.setCaption( i18n( "Edit Delegate" ) ); - - dlg.setDelegate( oldDelegate ); - - if ( !dlg.exec() ) - return; - - const Scalix::Delegate delegate = dlg.delegate(); - - if ( !delegate.isValid() ) - return; - - Scalix::SetDelegateJob *job = Scalix::setDelegate( Settings::self()->globalSlave(), - Settings::self()->accountUrl(), - delegate.email(), delegate.rights() ); - connect( job, TQT_SIGNAL( result( TDEIO::Job* ) ), TQT_SLOT( delegateAdded( TDEIO::Job* ) ) ); -} - -void DelegatePage::removeDelegate() -{ - const Scalix::Delegate delegate = mView->selectedDelegate(); - if ( !delegate.isValid() ) - return; - - Scalix::DeleteDelegateJob *job = Scalix::deleteDelegate( Settings::self()->globalSlave(), - Settings::self()->accountUrl(), delegate.email() ); - connect( job, TQT_SIGNAL( result( TDEIO::Job* ) ), TQT_SLOT( delegateRemoved( TDEIO::Job* ) ) ); -} - -void DelegatePage::allDelegates( TDEIO::Job *job ) -{ - if ( job->error() ) - KMessageBox::error( this, job->errorString() ); - - Scalix::GetDelegatesJob *delegateJob = static_cast( job ); - - mManager.clear(); - - const Scalix::Delegate::List delegates = delegateJob->delegates(); - for ( uint i = 0; i < delegates.count(); ++i ) - mManager.addDelegate( delegates[ i ] ); - - selectionChanged(); -} - -void DelegatePage::delegateAdded( TDEIO::Job *job ) -{ - if ( job->error() ) - KMessageBox::error( this, job->errorString() ); - else - loadAllDelegates(); // update the GUI -} - -void DelegatePage::delegateRemoved( TDEIO::Job *job ) -{ - if ( job->error() ) - KMessageBox::error( this, job->errorString() ); - else - loadAllDelegates(); // update the GUI -} - -void DelegatePage::selectionChanged() -{ - bool state = ( mView->selectedItem() != 0 ); - - mEditButton->setEnabled( state ); - mRemoveButton->setEnabled( state ); -} - -#include "delegatepage.moc" diff --git a/kresources/scalix/scalixadmin/delegatepage.h b/kresources/scalix/scalixadmin/delegatepage.h deleted file mode 100644 index 0523effee..000000000 --- a/kresources/scalix/scalixadmin/delegatepage.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 DELEGATEPAGE_H -#define DELEGATEPAGE_H - -#include - -#include "delegatemanager.h" - -class TQPushButton; -class DelegateView; - -class DelegatePage : public TQWidget -{ - Q_OBJECT - - - public: - DelegatePage( TQWidget *parent = 0 ); - ~DelegatePage(); - - private slots: - void loadAllDelegates(); - void addDelegate(); - void editDelegate(); - void removeDelegate(); - - void delegateAdded( TDEIO::Job* ); - void delegateRemoved( TDEIO::Job* ); - void allDelegates( TDEIO::Job* ); - - void selectionChanged(); - - private: - TQPushButton *mAddButton; - TQPushButton *mEditButton; - TQPushButton *mRemoveButton; - - DelegateManager mManager; - DelegateView *mView; -}; - -#endif diff --git a/kresources/scalix/scalixadmin/delegateview.cpp b/kresources/scalix/scalixadmin/delegateview.cpp deleted file mode 100644 index 1031f460e..000000000 --- a/kresources/scalix/scalixadmin/delegateview.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 - -#include "delegatemanager.h" - -#include "delegateview.h" - -class DelegateItem : public TQListViewItem -{ - public: - DelegateItem( TQListView *parent, const Scalix::Delegate &delegate ) - : TQListViewItem( parent ), mDelegate( delegate ) - { - setText( 0, mDelegate.email() ); - setText( 1, Scalix::Delegate::rightsAsString( mDelegate.rights() ) ); - } - - Scalix::Delegate delegate() const { return mDelegate; } - - private: - Scalix::Delegate mDelegate; -}; - -DelegateView::DelegateView( DelegateManager *manager, TQWidget *parent ) - : KListView( parent ), mManager( manager ) -{ - addColumn( i18n( "Delegate" ) ); - addColumn( i18n( "Rights" ) ); - setFullWidth( true ); - setAllColumnsShowFocus( true ); - - connect( mManager, TQT_SIGNAL( changed() ), TQT_SLOT( delegateChanged() ) ); - - delegateChanged(); -} - -Scalix::Delegate DelegateView::selectedDelegate() const -{ - DelegateItem *item = dynamic_cast( selectedItem() ); - if ( item ) - return item->delegate(); - - return Scalix::Delegate(); -} - -void DelegateView::delegateChanged() -{ - clear(); - - const Scalix::Delegate::List delegates = mManager->delegates(); - for ( uint i = 0; i < delegates.count(); ++i ) - new DelegateItem( this, delegates[ i ] ); -} - -#include "delegateview.moc" diff --git a/kresources/scalix/scalixadmin/delegateview.h b/kresources/scalix/scalixadmin/delegateview.h deleted file mode 100644 index 5dfa379f7..000000000 --- a/kresources/scalix/scalixadmin/delegateview.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 DELEGATEVIEW_H -#define DELEGATEVIEW_H - -#include - -namespace Scalix { -class Delegate; -} - -class DelegateManager; - -class DelegateView : public KListView -{ - Q_OBJECT - - - public: - DelegateView( DelegateManager *manager, TQWidget *parent = 0 ); - - Scalix::Delegate selectedDelegate() const; - - private slots: - void delegateChanged(); - - private: - DelegateManager *mManager; -}; - -#endif diff --git a/kresources/scalix/scalixadmin/jobs.cpp b/kresources/scalix/scalixadmin/jobs.cpp deleted file mode 100644 index 49b0a8fe5..000000000 --- a/kresources/scalix/scalixadmin/jobs.cpp +++ /dev/null @@ -1,306 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 -#include - -#include "jobs.h" - -using namespace Scalix; - -Delegate::Delegate() - : mRights( -1 ) -{ -} - -Delegate::Delegate( const TQString &email, int rights ) - : mEmail( email ), mRights( rights ) -{ -} - -bool Delegate::isValid() const -{ - return ( !mEmail.isEmpty() && mRights != -1 ); -} - -TQString Delegate::email() const -{ - return mEmail; -} - -int Delegate::rights() const -{ - return mRights; -} - -TQString Delegate::rightsAsString( int rights ) -{ - TQStringList rightNames; - - if ( rights & SendOnBehalfOf ) - rightNames.append( i18n( "Send on behalf of" ) ); - if ( rights & SeePrivate ) - rightNames.append( i18n( "See private" ) ); - if ( rights & GetMeetings ) - rightNames.append( i18n( "Get meetings" ) ); - if ( rights & InsteadOfMe ) - rightNames.append( i18n( "Instead of me" ) ); - - return rightNames.join( ", " ); -} - - -SetPasswordJob* Scalix::setPassword( TDEIO::Slave* slave, const KURL& url, - const TQString &oldPassword, const TQString& newPassword ) -{ - TQByteArray packedArgs; - TQDataStream stream( packedArgs, IO_WriteOnly ); - stream << (int)'X' << (int)'N' - << TQString( "X-SCALIX-PASSWORD" ) << TQString( "%1 %2" ).arg( oldPassword ).arg( newPassword ); - - SetPasswordJob* job = new SetPasswordJob( url, packedArgs, false ); - TDEIO::Scheduler::assignJobToSlave( slave, job ); - return job; -} - -SetDelegateJob* Scalix::setDelegate( TDEIO::Slave* slave, const KURL& url, const TQString& email, int params ) -{ - TQStringList types; - if ( params & SendOnBehalfOf ) - types.append( "SOBO" ); - if ( params & SeePrivate ) - types.append( "SEEPRIVATE" ); - if ( params & GetMeetings ) - types.append( "GETMEETINGS" ); - if ( params & InsteadOfMe ) - types.append( "INSTEADOFME" ); - - TQByteArray packedArgs; - TQDataStream stream( packedArgs, IO_WriteOnly ); - stream << (int)'X' << (int)'N' - << TQString( "X-SET-DELEGATE" ) << TQString( "%1 %2" ).arg( email ).arg( types.join( " " ) ); - - SetDelegateJob* job = new SetDelegateJob( url, packedArgs, false ); - TDEIO::Scheduler::assignJobToSlave( slave, job ); - return job; -} - -DeleteDelegateJob* Scalix::deleteDelegate( TDEIO::Slave* slave, const KURL& url, const TQString& email ) -{ - TQByteArray packedArgs; - TQDataStream stream( packedArgs, IO_WriteOnly ); - stream << (int)'X' << (int)'N' - << TQString( "X-DELETE-DELEGATE" ) << email; - - DeleteDelegateJob* job = new DeleteDelegateJob( url, packedArgs, false ); - TDEIO::Scheduler::assignJobToSlave( slave, job ); - return job; -} - -GetDelegatesJob* Scalix::getDelegates( TDEIO::Slave* slave, const KURL& url ) -{ - TQByteArray packedArgs; - TQDataStream stream( packedArgs, IO_WriteOnly ); - stream << (int)'X' << (int)'N' << TQString( "X-GET-DELEGATES" ) << TQString(); - - GetDelegatesJob* job = new GetDelegatesJob( url, packedArgs, false ); - TDEIO::Scheduler::assignJobToSlave( slave, job ); - return job; -} - -AddOtherUserJob* Scalix::addOtherUser( TDEIO::Slave* slave, const KURL& url, const TQString& email ) -{ - TQByteArray packedArgs; - TQDataStream stream( packedArgs, IO_WriteOnly ); - stream << (int)'X' << (int)'N' - << TQString( "X-ADD-OTHER-USER" ) << email; - - AddOtherUserJob* job = new AddOtherUserJob( url, packedArgs, false ); - TDEIO::Scheduler::assignJobToSlave( slave, job ); - return job; -} - -DeleteOtherUserJob* Scalix::deleteOtherUser( TDEIO::Slave* slave, const KURL& url, const TQString& email ) -{ - TQByteArray packedArgs; - TQDataStream stream( packedArgs, IO_WriteOnly ); - stream << (int)'X' << (int)'N' - << TQString( "X-DELETE-OTHER-USER" ) << email; - - DeleteOtherUserJob* job = new DeleteOtherUserJob( url, packedArgs, false ); - TDEIO::Scheduler::assignJobToSlave( slave, job ); - return job; -} - -GetOtherUsersJob* Scalix::getOtherUsers( TDEIO::Slave* slave, const KURL& url ) -{ - TQByteArray packedArgs; - TQDataStream stream( packedArgs, IO_WriteOnly ); - stream << (int)'X' << (int)'N' - << TQString( "X-GET-OTHER-USERS" ) << TQString(); - - GetOtherUsersJob* job = new GetOtherUsersJob( url, packedArgs, false ); - TDEIO::Scheduler::assignJobToSlave( slave, job ); - return job; -} - -SetOutOfOfficeJob* Scalix::setOutOfOffice( TDEIO::Slave* slave, const KURL& url, bool enabled, const TQString& msg ) -{ - const TQString argument = msg; - const TQString command = TQString( "X-SET-OUT-OF-OFFICE %1 %2 {%3}" ).arg( enabled ? "ENABLED" : "DISABLED" ) - .arg( "UTF-8" ) - .arg( msg.utf8().length() ); - - TQByteArray packedArgs; - TQDataStream stream( packedArgs, IO_WriteOnly ); - stream << (int) 'X' << (int)'E' << command << argument; - - SetOutOfOfficeJob* job = new SetOutOfOfficeJob( url, packedArgs, false ); - TDEIO::Scheduler::assignJobToSlave( slave, job ); - return job; -} - -GetOutOfOfficeJob* Scalix::getOutOfOffice( TDEIO::Slave* slave, const KURL& url ) -{ - TQByteArray packedArgs; - TQDataStream stream( packedArgs, IO_WriteOnly ); - stream << (int)'X' << (int)'N' - << TQString( "X-GET-OUT-OF-OFFICE" ) << TQString(); - - GetOutOfOfficeJob* job = new GetOutOfOfficeJob( url, packedArgs, false ); - TDEIO::Scheduler::assignJobToSlave( slave, job ); - return job; -} - -SetPasswordJob::SetPasswordJob( const KURL& url, const TQByteArray &packedArgs, bool showProgressInfo ) - : TDEIO::SimpleJob( url, TDEIO::CMD_SPECIAL, packedArgs, showProgressInfo ) -{ -} - -SetDelegateJob::SetDelegateJob( const KURL& url, const TQByteArray &packedArgs, bool showProgressInfo ) - : TDEIO::SimpleJob( url, TDEIO::CMD_SPECIAL, packedArgs, showProgressInfo ) -{ -} - -DeleteDelegateJob::DeleteDelegateJob( const KURL& url, const TQByteArray &packedArgs, bool showProgressInfo ) - : TDEIO::SimpleJob( url, TDEIO::CMD_SPECIAL, packedArgs, showProgressInfo ) -{ -} - -GetDelegatesJob::GetDelegatesJob( const KURL& url, const TQByteArray &packedArgs, bool showProgressInfo ) - : TDEIO::SimpleJob( url, TDEIO::CMD_SPECIAL, packedArgs, showProgressInfo ) -{ - connect( this, TQT_SIGNAL( infoMessage( TDEIO::Job*, const TQString& ) ), - this, TQT_SLOT( slotInfoMessage( TDEIO::Job*, const TQString& ) ) ); -} - -Delegate::List GetDelegatesJob::delegates() const -{ - return mDelegates; -} - -void GetDelegatesJob::slotInfoMessage( TDEIO::Job*, const TQString &data ) -{ - /** - * The passed data have the following form: - * - * "user1@host.com:right1,right2,right4 user2@host.com:right3,right5" - */ - TQStringList delegates = TQStringList::split( ' ', data ); - for ( uint i = 0; i < delegates.count(); ++i ) { - TQStringList delegate = TQStringList::split( ':', delegates[ i ] ); - - const TQString email = delegate[ 0 ]; - int rights = 0; - - TQStringList rightsList = TQStringList::split( ',', delegate[ 1 ] ); - for ( uint j = 0; j < rightsList.count(); ++j ) { - if ( rightsList[ j ] == "SOBO" ) - rights |= SendOnBehalfOf; - else if ( rightsList[ j ] == "SEEPRIVATE" ) - rights |= SeePrivate; - else if ( rightsList[ j ] == "GETMEETINGS" ) - rights |= GetMeetings; - else if ( rightsList[ j ] == "INSTEADOFME" ) - rights |= InsteadOfMe; - } - - mDelegates.append( Delegate( email, rights ) ); - } -} - -AddOtherUserJob::AddOtherUserJob( const KURL& url, const TQByteArray &packedArgs, bool showProgressInfo ) - : TDEIO::SimpleJob( url, TDEIO::CMD_SPECIAL, packedArgs, showProgressInfo ) -{ -} - -DeleteOtherUserJob::DeleteOtherUserJob( const KURL& url, const TQByteArray &packedArgs, bool showProgressInfo ) - : TDEIO::SimpleJob( url, TDEIO::CMD_SPECIAL, packedArgs, showProgressInfo ) -{ -} - -GetOtherUsersJob::GetOtherUsersJob( const KURL& url, const TQByteArray &packedArgs, bool showProgressInfo ) - : TDEIO::SimpleJob( url, TDEIO::CMD_SPECIAL, packedArgs, showProgressInfo ) -{ - connect( this, TQT_SIGNAL( infoMessage( TDEIO::Job*, const TQString& ) ), - this, TQT_SLOT( slotInfoMessage( TDEIO::Job*, const TQString& ) ) ); -} - -TQStringList GetOtherUsersJob::otherUsers() const -{ - return mOtherUsers; -} - -void GetOtherUsersJob::slotInfoMessage( TDEIO::Job*, const TQString &data ) -{ - mOtherUsers = TQStringList::split( ' ', data ); -} - -SetOutOfOfficeJob::SetOutOfOfficeJob( const KURL& url, const TQByteArray &packedArgs, bool showProgressInfo ) - : TDEIO::SimpleJob( url, TDEIO::CMD_SPECIAL, packedArgs, showProgressInfo ) -{ -} - -GetOutOfOfficeJob::GetOutOfOfficeJob( const KURL& url, const TQByteArray &packedArgs, bool showProgressInfo ) - : TDEIO::SimpleJob( url, TDEIO::CMD_SPECIAL, packedArgs, showProgressInfo ) -{ - connect( this, TQT_SIGNAL( infoMessage( TDEIO::Job*, const TQString& ) ), - this, TQT_SLOT( slotInfoMessage( TDEIO::Job*, const TQString& ) ) ); -} - -bool GetOutOfOfficeJob::enabled() const -{ - return mEnabled; -} - -TQString GetOutOfOfficeJob::message() const -{ - return mMessage; -} - -void GetOutOfOfficeJob::slotInfoMessage( TDEIO::Job*, const TQString &data ) -{ - const TQStringList fields = TQStringList::split( '^', data ); - - mEnabled = ( fields[ 0 ] == "ENABLED" ); - mMessage = fields[ 1 ]; -} - -#include "jobs.moc" diff --git a/kresources/scalix/scalixadmin/jobs.h b/kresources/scalix/scalixadmin/jobs.h deleted file mode 100644 index 0c73fb507..000000000 --- a/kresources/scalix/scalixadmin/jobs.h +++ /dev/null @@ -1,205 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 - -#ifndef JOBS_H -#define JOBS_H - -namespace Scalix { - - enum DelegateTypes - { - SendOnBehalfOf = 1, - SeePrivate = 2, - GetMeetings = 4, - InsteadOfMe = 8 - }; - - class SetPasswordJob; - class SetDelegateJob; - class DeleteDelegateJob; - class GetDelegatesJob; - class AddOtherUserJob; - class DeleteOtherUserJob; - class GetOtherUsersJob; - class SetOutOfOfficeJob; - class GetOutOfOfficeJob; - - class Delegate - { - public: - typedef TQValueList List; - - Delegate(); - Delegate( const TQString &email, int rights ); - - bool isValid() const; - - TQString email() const; - int rights() const; - - static TQString rightsAsString( int rights ); - - private: - TQString mEmail; - int mRights; - }; - - /** - * Sets/Changes the password of the user encoded in @p url. - */ - SetPasswordJob* setPassword( TDEIO::Slave* slave, const KURL& url, const TQString& oldPassword, const TQString& newPassword ); - - /** - * Adds a delegate represented by @p email with the given @p params for the user encoded in @p url. - */ - SetDelegateJob* setDelegate( TDEIO::Slave* slave, const KURL& url, const TQString& email, int params ); - - /** - * Deletes the delegate represented by @p email for the user encoded in @p url. - */ - DeleteDelegateJob* deleteDelegate( TDEIO::Slave* slave, const KURL& url, const TQString& email ); - - /** - * Retrieves the delegates for the user encoded in @p url. - */ - GetDelegatesJob* getDelegates( TDEIO::Slave* slave, const KURL& url ); - - /** - * Adds the mailbox of another user represented by @p email to the users 'Other Users' namespace. - */ - AddOtherUserJob* addOtherUser( TDEIO::Slave* slave, const KURL& url, const TQString& email ); - - /** - * Deletes the mailbox of another user represented by @p email from the users 'Other Users' namespace. - */ - DeleteOtherUserJob* deleteOtherUser( TDEIO::Slave* slave, const KURL& url, const TQString& email ); - - /** - * Retrieves the list of all other users. - */ - GetOtherUsersJob* getOtherUsers( TDEIO::Slave* slave, const KURL& url ); - - /** - * Sets the out-of-office data. - * - * @param enabled Whether the out-of-office functionality is enabled. - * @param msg The out-of-office message. - */ - SetOutOfOfficeJob* setOutOfOffice( TDEIO::Slave* slave, const KURL& url, bool enabled, const TQString& msg ); - - /** - * Retrieves the out-of-office data. - */ - GetOutOfOfficeJob* getOutOfOffice( TDEIO::Slave* slave, const KURL& url ); - - - class SetPasswordJob : public TDEIO::SimpleJob - { - public: - SetPasswordJob( const KURL& url, const TQByteArray &packedArgs, bool showProgressInfo ); - }; - - class SetDelegateJob : public TDEIO::SimpleJob - { - public: - SetDelegateJob( const KURL& url, const TQByteArray &packedArgs, bool showProgressInfo ); - }; - - class DeleteDelegateJob : public TDEIO::SimpleJob - { - public: - DeleteDelegateJob( const KURL& url, const TQByteArray &packedArgs, bool showProgressInfo ); - }; - - class GetDelegatesJob : public TDEIO::SimpleJob - { - Q_OBJECT - - - public: - GetDelegatesJob( const KURL& url, const TQByteArray &packedArgs, bool showProgressInfo ); - - Delegate::List delegates() const; - - private slots: - void slotInfoMessage( TDEIO::Job*, const TQString& ); - - private: - Delegate::List mDelegates; - }; - - class AddOtherUserJob : public TDEIO::SimpleJob - { - public: - AddOtherUserJob( const KURL& url, const TQByteArray &packedArgs, bool showProgressInfo ); - }; - - class DeleteOtherUserJob : public TDEIO::SimpleJob - { - public: - DeleteOtherUserJob( const KURL& url, const TQByteArray &packedArgs, bool showProgressInfo ); - }; - - class GetOtherUsersJob : public TDEIO::SimpleJob - { - Q_OBJECT - - - public: - GetOtherUsersJob( const KURL& url, const TQByteArray &packedArgs, bool showProgressInfo ); - - TQStringList otherUsers() const; - - private slots: - void slotInfoMessage( TDEIO::Job*, const TQString& ); - - private: - TQStringList mOtherUsers; - }; - - class SetOutOfOfficeJob : public TDEIO::SimpleJob - { - public: - SetOutOfOfficeJob( const KURL& url, const TQByteArray &packedArgs, bool showProgressInfo ); - }; - - class GetOutOfOfficeJob : public TDEIO::SimpleJob - { - Q_OBJECT - - - public: - GetOutOfOfficeJob( const KURL& url, const TQByteArray &packedArgs, bool showProgressInfo ); - - bool enabled() const; - TQString message() const; - - private slots: - void slotInfoMessage( TDEIO::Job*, const TQString& ); - - private: - bool mEnabled; - TQString mMessage; - }; -} - -#endif diff --git a/kresources/scalix/scalixadmin/ldapdialog.cpp b/kresources/scalix/scalixadmin/ldapdialog.cpp deleted file mode 100644 index 6af08c4d7..000000000 --- a/kresources/scalix/scalixadmin/ldapdialog.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 - -#include "ldapview.h" - -#include "ldapdialog.h" - -LdapDialog::LdapDialog( TQWidget *parent ) - : KDialogBase( parent, "", true, "", Ok | Cancel, Ok, true ) -{ - setCaption( i18n( "User Account Selection" ) ); - - mView = new LdapView( this ); - setMainWidget( mView ); - - mView->setQuery( "cn=*" ); - - resize( 400, 250 ); -} - -TQString LdapDialog::selectedUser() const -{ - return mView->selectedUser(); -} diff --git a/kresources/scalix/scalixadmin/ldapdialog.h b/kresources/scalix/scalixadmin/ldapdialog.h deleted file mode 100644 index 9d822af19..000000000 --- a/kresources/scalix/scalixadmin/ldapdialog.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 LDAPDIALOG_H -#define LDAPDIALOG_H - -#include - -class LdapView; - -class LdapDialog : public KDialogBase -{ - public: - LdapDialog( TQWidget *parent = 0 ); - - TQString selectedUser() const; - - - private: - LdapView *mView; -}; - -#endif diff --git a/kresources/scalix/scalixadmin/ldapview.cpp b/kresources/scalix/scalixadmin/ldapview.cpp deleted file mode 100644 index adf2fe3fa..000000000 --- a/kresources/scalix/scalixadmin/ldapview.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 -#include -#include - -#include "settings.h" - -#include "ldapview.h" - -class LdapItem : public TQListViewItem -{ - public: - LdapItem( TQListView *parent, const TQString &text, const TQString &email ) - : TQListViewItem( parent ) - { - setText( 0, text ); - setText( 1, email ); - } -}; - - -LdapView::LdapView( TQWidget *parent ) - : KListView( parent ) -{ - addColumn( i18n( "User" ) ); - setFullWidth( true ); - - mClient = new KABC::LdapClient; - - mClient->setHost( Settings::self()->ldapHost() ); - mClient->setPort( Settings::self()->ldapPort() ); - mClient->setBase( Settings::self()->ldapBase() ); - mClient->setBindDN( Settings::self()->ldapBindDn() ); - mClient->setPwdBindDN( Settings::self()->ldapPassword() ); - - TQStringList attrs; - attrs << "surname" << "mail"; - mClient->setAttrs( attrs ); - - connect( mClient, TQT_SIGNAL( result( const KABC::LdapObject& ) ), - this, TQT_SLOT( entryAdded( const KABC::LdapObject& ) ) ); - connect( mClient, TQT_SIGNAL( error( const TQString& ) ), - this, TQT_SLOT( error( const TQString& ) ) ); -} - -LdapView::~LdapView() -{ - mClient->cancelQuery(); - delete mClient; -} - -TQString LdapView::selectedUser() const -{ - TQListViewItem *item = selectedItem(); - if ( !item ) - return TQString(); - else - return item->text( 1 ); -} - -void LdapView::setQuery( const TQString &query ) -{ - clear(); - mClient->startQuery( query ); -} - -void LdapView::entryAdded( const KABC::LdapObject &obj ) -{ - const TQString text = TQString( "%1 (%2)" ).arg( TQString(obj.attrs[ "surname" ].first()) ) - .arg( TQString(obj.attrs[ "mail" ].first()) ); - - new LdapItem( this, text, obj.attrs[ "mail" ].first() ); -} - -void LdapView::error( const TQString &msg ) -{ - KMessageBox::error( this, msg ); -} - -#include "ldapview.moc" diff --git a/kresources/scalix/scalixadmin/ldapview.h b/kresources/scalix/scalixadmin/ldapview.h deleted file mode 100644 index 6af41aa75..000000000 --- a/kresources/scalix/scalixadmin/ldapview.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 LDAPVIEW_H -#define LDAPVIEW_H - -#include - -namespace KABC { -class LdapClient; -class LdapObject; -} - -class LdapView : public KListView -{ - Q_OBJECT - - - public: - LdapView( TQWidget *parent = 0 ); - ~LdapView(); - - TQString selectedUser() const; - - public slots: - void setQuery( const TQString &query ); - - private slots: - void entryAdded( const KABC::LdapObject& ); - void error( const TQString& ); - - private: - KABC::LdapClient *mClient; -}; - -#endif diff --git a/kresources/scalix/scalixadmin/main.cpp b/kresources/scalix/scalixadmin/main.cpp deleted file mode 100644 index 6b9192a33..000000000 --- a/kresources/scalix/scalixadmin/main.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 -#include -#include -#include - -#include "mainwindow.h" - -static const char description[] = I18N_NOOP("Configuration Tool for Scalix Groupware Konnector"); - -static KCmdLineOptions options[] = -{ - KCmdLineLastOption -}; - -int main( int argc, char **argv ) -{ - TDEAboutData aboutData( "scalixadmin", I18N_NOOP("ScalixAdmin"), "1.0", description, - TDEAboutData::License_GPL, "(c) 2007, Tobias Koenig" ); - aboutData.addAuthor( "Tobias Koenig",0, "tokoe@kde.org" ); - TDECmdLineArgs::init( argc, argv, &aboutData ); - TDECmdLineArgs::addCmdLineOptions( options ); - - TDEApplication app; - - TDEGlobal::locale()->insertCatalogue( "scalixadmin" ); - - MainWindow *window = new MainWindow; - window->show(); - - app.setMainWidget( window ); - - return app.exec(); -} diff --git a/kresources/scalix/scalixadmin/mainwindow.cpp b/kresources/scalix/scalixadmin/mainwindow.cpp deleted file mode 100644 index 04e396d78..000000000 --- a/kresources/scalix/scalixadmin/mainwindow.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 - -#include -#include -#include -#include - -#include "delegatepage.h" -#include "otheruserpage.h" -#include "outofofficepage.h" -#include "passwordpage.h" - -#include "mainwindow.h" - -MainWindow::MainWindow() - : KMainWindow( 0 ) -{ - KJanusWidget *wdg = new KJanusWidget( this, "", KJanusWidget::IconList ); - - TQPixmap icon = TDEGlobal::iconLoader()->loadIcon( "folder_yellow", KIcon::Desktop ); - TQVBox *page = wdg->addVBoxPage( i18n( "Other Accounts" ), i18n( "Register other accounts" ), icon ); - new OtherUserPage( page ); - - icon = TDEGlobal::iconLoader()->loadIcon( "edu_languages", KIcon::Desktop ); - page = wdg->addVBoxPage( i18n( "Delegates" ), i18n( "Setup delegates for my account" ), icon ); - new DelegatePage( page ); - - icon = TDEGlobal::iconLoader()->loadIcon( "kontact_summary_green", KIcon::Desktop ); - page = wdg->addVBoxPage( i18n( "Out of Office..." ), i18n( "Setup Out of Office Message" ), icon ); - new OutOfOfficePage( page ); - - icon = TDEGlobal::iconLoader()->loadIcon( "password", KIcon::Desktop ); - page = wdg->addVBoxPage( i18n( "Password" ), i18n( "Change the password" ), icon ); - new PasswordPage( page ); - - setCentralWidget( wdg ); - - resize( 540, 450 ); -} diff --git a/kresources/scalix/scalixadmin/mainwindow.h b/kresources/scalix/scalixadmin/mainwindow.h deleted file mode 100644 index 38c955980..000000000 --- a/kresources/scalix/scalixadmin/mainwindow.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 MAINWINDOW_H -#define MAINWINDOW_H - -#include - -class MainWindow : public KMainWindow -{ - public: - MainWindow(); -}; - -#endif diff --git a/kresources/scalix/scalixadmin/otherusermanager.cpp b/kresources/scalix/scalixadmin/otherusermanager.cpp deleted file mode 100644 index a3c19de12..000000000 --- a/kresources/scalix/scalixadmin/otherusermanager.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 "otherusermanager.h" - -OtherUserManager::OtherUserManager() -{ -} - -OtherUserManager::~OtherUserManager() -{ -} - -void OtherUserManager::addOtherUser( const TQString &email ) -{ - if ( !mOtherUsers.contains( email ) ) { - mOtherUsers.append( email ); - emit changed(); - } -} - -void OtherUserManager::clear() -{ - mOtherUsers.clear(); - - emit changed(); -} - -TQStringList OtherUserManager::otherUsers() const -{ - return mOtherUsers; -} - -#include "otherusermanager.moc" diff --git a/kresources/scalix/scalixadmin/otherusermanager.h b/kresources/scalix/scalixadmin/otherusermanager.h deleted file mode 100644 index 26f33ee4e..000000000 --- a/kresources/scalix/scalixadmin/otherusermanager.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 OTHERUSERMANAGER_H -#define OTHERUSERMANAGER_H - -#include -#include - -class OtherUserManager : public TQObject -{ - Q_OBJECT - - - public: - OtherUserManager(); - ~OtherUserManager(); - - void addOtherUser( const TQString &email ); - void clear(); - - TQStringList otherUsers() const; - - signals: - void changed(); - - private: - TQStringList mOtherUsers; -}; - -#endif diff --git a/kresources/scalix/scalixadmin/otheruserpage.cpp b/kresources/scalix/scalixadmin/otheruserpage.cpp deleted file mode 100644 index 3aac47c9e..000000000 --- a/kresources/scalix/scalixadmin/otheruserpage.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 -#include -#include - -#include -#include -#include -#include -#include - -#include - -#include "jobs.h" -#include "ldapdialog.h" -#include "otheruserview.h" -#include "settings.h" - -#include "otheruserpage.h" - -OtherUserPage::OtherUserPage( TQWidget *parent ) - : TQWidget( parent ) -{ - TQGridLayout *layout = new TQGridLayout( this, 2, 2, 11, 6 ); - - mView = new OtherUserView( &mManager, this ); - layout->addMultiCellWidget( mView, 0, 0, 0, 1 ); - - mAddButton = new TQPushButton( i18n( "Add Account..." ), this ); - layout->addWidget( mAddButton, 1, 0 ); - - mDeleteButton = new TQPushButton( i18n( "Remove Account" ), this ); - mDeleteButton->setEnabled( false ); - layout->addWidget( mDeleteButton, 1, 1 ); - - connect( mView, TQT_SIGNAL( selectionChanged() ), TQT_SLOT( selectionChanged() ) ); - connect( mAddButton, TQT_SIGNAL( clicked() ), TQT_SLOT( addUser() ) ); - connect( mDeleteButton, TQT_SIGNAL( clicked() ), TQT_SLOT( removeUser() ) ); - - loadAllUsers(); -} - -OtherUserPage::~OtherUserPage() -{ -} - -void OtherUserPage::loadAllUsers() -{ - Scalix::GetOtherUsersJob *job = Scalix::getOtherUsers( Settings::self()->globalSlave(), - Settings::self()->accountUrl() ); - connect( job, TQT_SIGNAL( result( TDEIO::Job* ) ), TQT_SLOT( allUsers( TDEIO::Job* ) ) ); -} - -void OtherUserPage::addUser() -{ - LdapDialog dlg( this ); - if ( !dlg.exec() ) - return; - - const TQString email = dlg.selectedUser(); - if ( email.isEmpty() ) - return; - - Scalix::AddOtherUserJob *job = Scalix::addOtherUser( Settings::self()->globalSlave(), - Settings::self()->accountUrl(), email ); - connect( job, TQT_SIGNAL( result( TDEIO::Job* ) ), TQT_SLOT( userAdded( TDEIO::Job* ) ) ); -} - -void OtherUserPage::removeUser() -{ - const TQString email = mView->selectedUser(); - if ( email.isEmpty() ) - return; - - Scalix::DeleteOtherUserJob *job = Scalix::deleteOtherUser( Settings::self()->globalSlave(), - Settings::self()->accountUrl(), email ); - connect( job, TQT_SIGNAL( result( TDEIO::Job* ) ), TQT_SLOT( userRemoved( TDEIO::Job* ) ) ); -} - -void OtherUserPage::allUsers( TDEIO::Job *job ) -{ - if ( job->error() ) - KMessageBox::error( this, job->errorString() ); - - Scalix::GetOtherUsersJob *userJob = static_cast( job ); - - mManager.clear(); - - const TQStringList users = userJob->otherUsers(); - for ( uint i = 0; i < users.count(); ++i ) - mManager.addOtherUser( users[ i ] ); - - selectionChanged(); -} - -void OtherUserPage::userAdded( TDEIO::Job *job ) -{ - if ( job->error() ) - KMessageBox::error( this, job->errorString() ); - else - loadAllUsers(); // update the GUI - - updateKmail(); -} - -void OtherUserPage::userRemoved( TDEIO::Job *job ) -{ - if ( job->error() ) - KMessageBox::error( this, job->errorString() ); - else - loadAllUsers(); // update the GUI - - updateKmail(); -} - -void OtherUserPage::selectionChanged() -{ - mDeleteButton->setEnabled( mView->selectedItem() != 0 ); -} - -void OtherUserPage::updateKmail() -{ - TQMessageBox *msg = new TQMessageBox( tqApp->mainWidget() ); - msg->setText( i18n( "Updating account..." ) ); - msg->show(); - tqApp->processEvents(); - sleep( 1 ); - tqApp->processEvents(); - - TQString error; - TQCString dcopService; - int result = KDCOPServiceStarter::self()-> - findServiceFor( "DCOP/ResourceBackend/IMAP", TQString(), - TQString(), &error, &dcopService ); - if ( result != 0 ) { - KMessageBox::error( 0, i18n( "Unable to start KMail to trigger account update with Scalix server" ) ); - delete msg; - return; - } - - DCOPRef ref( dcopService, "KMailIface" ); - - // loop until dcop iface is set up correctly - TQStringList list; - while ( list.isEmpty() ) { - ref.call( "accounts()" ).get( list ); - } - - ref.call( "checkAccount(TQString)", i18n( "Scalix Server" ) ); - - delete msg; -} - -#include "otheruserpage.moc" diff --git a/kresources/scalix/scalixadmin/otheruserpage.h b/kresources/scalix/scalixadmin/otheruserpage.h deleted file mode 100644 index e8c5e269d..000000000 --- a/kresources/scalix/scalixadmin/otheruserpage.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 OTHERUSERPAGE_H -#define OTHERUSERPAGE_H - -#include - -#include "otherusermanager.h" - -class TQPushButton; -class OtherUserView; - -class OtherUserPage : public TQWidget -{ - Q_OBJECT - - - public: - OtherUserPage( TQWidget *parent = 0 ); - ~OtherUserPage(); - - private slots: - void loadAllUsers(); - void addUser(); - void removeUser(); - - void userAdded( TDEIO::Job* ); - void userRemoved( TDEIO::Job* ); - void allUsers( TDEIO::Job* ); - - void selectionChanged(); - - private: - void updateKmail(); - - TQPushButton *mAddButton; - TQPushButton *mDeleteButton; - - OtherUserManager mManager; - OtherUserView *mView; -}; - -#endif diff --git a/kresources/scalix/scalixadmin/otheruserview.cpp b/kresources/scalix/scalixadmin/otheruserview.cpp deleted file mode 100644 index 25a694287..000000000 --- a/kresources/scalix/scalixadmin/otheruserview.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 - -#include "otherusermanager.h" - -#include "otheruserview.h" - -class OtherUserItem : public TQListViewItem -{ - public: - OtherUserItem( TQListView *parent, const TQString &user ) - : TQListViewItem( parent ), mUser( user ) - { - setText( 0, mUser ); - } - - TQString user() const { return mUser; } - - private: - TQString mUser; -}; - -OtherUserView::OtherUserView( OtherUserManager *manager, TQWidget *parent ) - : KListView( parent ), mManager( manager ) -{ - addColumn( i18n( "Registered Accounts" ) ); - setFullWidth( true ); - - connect( mManager, TQT_SIGNAL( changed() ), TQT_SLOT( userChanged() ) ); - - userChanged(); -} - -TQString OtherUserView::selectedUser() const -{ - OtherUserItem *item = dynamic_cast( selectedItem() ); - if ( item ) - return item->user(); - - return TQString(); -} - -void OtherUserView::userChanged() -{ - clear(); - - TQStringList users = mManager->otherUsers(); - for ( uint i = 0; i < users.count(); ++i ) - new OtherUserItem( this, users[ i ] ); -} - -#include "otheruserview.moc" diff --git a/kresources/scalix/scalixadmin/otheruserview.h b/kresources/scalix/scalixadmin/otheruserview.h deleted file mode 100644 index b5d3ff00e..000000000 --- a/kresources/scalix/scalixadmin/otheruserview.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 OTHERUSERVIEW_H -#define OTHERUSERVIEW_H - -#include - -class OtherUserManager; - -class OtherUserView : public KListView -{ - Q_OBJECT - - - public: - OtherUserView( OtherUserManager *manager, TQWidget *parent = 0 ); - - TQString selectedUser() const; - - private slots: - void userChanged(); - - private: - OtherUserManager *mManager; -}; - -#endif diff --git a/kresources/scalix/scalixadmin/outofofficepage.cpp b/kresources/scalix/scalixadmin/outofofficepage.cpp deleted file mode 100644 index 4e34a9144..000000000 --- a/kresources/scalix/scalixadmin/outofofficepage.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 -#include -#include -#include -#include -#include - -#include -#include - -#include "jobs.h" -#include "settings.h" - -#include "outofofficepage.h" - -OutOfOfficePage::OutOfOfficePage( TQWidget *parent ) - : TQWidget( parent ) -{ - TQGridLayout *layout = new TQGridLayout( this, 4, 2, 11, 6 ); - - TQButtonGroup *group = new TQButtonGroup( 1, Qt::Vertical, this ); - - mDisabled = new TQRadioButton( i18n( "I am in the office" ), group ); - mDisabled->setChecked( true ); - mEnabled = new TQRadioButton( i18n( "I am out of the office" ), group ); - - mLabel = new TQLabel( i18n( "Auto-reply once to each sender with the following text:" ), this ); - mMessage = new TQTextEdit( this ); - mSaveButton = new TQPushButton( i18n( "Save" ), this ); - - layout->addMultiCellWidget( group, 0, 0, 0, 1 ); - layout->addMultiCellWidget( mLabel, 1, 1, 0, 1 ); - layout->addMultiCellWidget( mMessage, 2, 2, 0, 1 ); - layout->addWidget( mSaveButton, 3, 1 ); - - statusChanged(); - - connect( mEnabled, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( statusChanged() ) ); - connect( mEnabled, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( changed() ) ); - connect( mSaveButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( store() ) ); - connect( mMessage, TQT_SIGNAL( textChanged() ), this, TQT_SLOT( changed() ) ); - - load(); -} - -OutOfOfficePage::~OutOfOfficePage() -{ -} - -void OutOfOfficePage::load() -{ - Scalix::GetOutOfOfficeJob *job = Scalix::getOutOfOffice( Settings::self()->globalSlave(), - Settings::self()->accountUrl() ); - connect( job, TQT_SIGNAL( result( TDEIO::Job* ) ), TQT_SLOT( loaded( TDEIO::Job* ) ) ); -} - -void OutOfOfficePage::loaded( TDEIO::Job* job ) -{ - if ( job->error() ) { - KMessageBox::error( this, job->errorString() ); - return; - } - - Scalix::GetOutOfOfficeJob *outOfOfficeJob = static_cast( job ); - - mEnabled->setChecked( outOfOfficeJob->enabled() ); - mMessage->setText( outOfOfficeJob->message() ); - - statusChanged(); - - mSaveButton->setEnabled( false ); -} - -void OutOfOfficePage::store() -{ - Scalix::SetOutOfOfficeJob *job = Scalix::setOutOfOffice( Settings::self()->globalSlave(), - Settings::self()->accountUrl(), - mEnabled->isChecked(), - mMessage->text() ); - - connect( job, TQT_SIGNAL( result( TDEIO::Job* ) ), TQT_SLOT( stored( TDEIO::Job* ) ) ); - - mSaveButton->setEnabled( false ); -} - -void OutOfOfficePage::stored( TDEIO::Job* job ) -{ - if ( job->error() ) - KMessageBox::error( this, job->errorString() ); -} - -void OutOfOfficePage::statusChanged() -{ - bool state = mEnabled->isChecked(); - - mLabel->setEnabled( state ); - mMessage->setEnabled( state ); -} - -void OutOfOfficePage::changed() -{ - mSaveButton->setEnabled( true ); -} - -#include "outofofficepage.moc" diff --git a/kresources/scalix/scalixadmin/outofofficepage.h b/kresources/scalix/scalixadmin/outofofficepage.h deleted file mode 100644 index f9863fa18..000000000 --- a/kresources/scalix/scalixadmin/outofofficepage.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 OUTOFOFFICEPAGE_H -#define OUTOFOFFICEPAGE_H - -#include - -class TQLabel; -class TQPushButton; -class TQRadioButton; -class TQTextEdit; - -class OutOfOfficePage : public TQWidget -{ - Q_OBJECT - - - public: - OutOfOfficePage( TQWidget *parent = 0 ); - ~OutOfOfficePage(); - - private slots: - void load(); - void loaded( TDEIO::Job* ); - void store(); - void stored( TDEIO::Job* ); - void statusChanged(); - void changed(); - - private: - TQRadioButton *mEnabled; - TQRadioButton *mDisabled; - TQLabel *mLabel; - TQTextEdit *mMessage; - TQPushButton *mSaveButton; - - bool mChanged; -}; - -#endif diff --git a/kresources/scalix/scalixadmin/passwordpage.cpp b/kresources/scalix/scalixadmin/passwordpage.cpp deleted file mode 100644 index 120de86f5..000000000 --- a/kresources/scalix/scalixadmin/passwordpage.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "jobs.h" -#include "settings.h" - -#include "passwordpage.h" - -PasswordPage::PasswordPage( TQWidget *parent ) - : TQWidget( parent ), mJob( 0 ) -{ - TQGridLayout *layout = new TQGridLayout( this, 2, 3, 11, 6 ); - - TQLabel *label = new TQLabel( i18n( "New password:" ), this ); - layout->addWidget( label, 0, 0 ); - - mPassword = new TQLineEdit( this ); - mPassword->setEchoMode( TQLineEdit::Password ); - label->setBuddy( mPassword ); - layout->addWidget( mPassword, 0, 1 ); - - label = new TQLabel( i18n( "Retype new password:" ), this ); - layout->addWidget( label, 1, 0 ); - - mPasswordRetype = new TQLineEdit( this ); - mPasswordRetype->setEchoMode( TQLineEdit::Password ); - label->setBuddy( mPasswordRetype ); - layout->addWidget( mPasswordRetype, 1, 1 ); - - mButton = new TQPushButton( i18n( "Change" ), this ); - mButton->setEnabled( false ); - layout->addWidget( mButton, 2, 1 ); - - layout->setRowSpacing( 3, 1 ); - - connect( mPassword, TQT_SIGNAL( textChanged( const TQString& ) ), this, TQT_SLOT( textChanged() ) ); - connect( mPasswordRetype, TQT_SIGNAL( textChanged( const TQString& ) ), this, TQT_SLOT( textChanged() ) ); - connect( mButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( buttonClicked() ) ); -} - -void PasswordPage::buttonClicked() -{ - if ( !mJob ) { - if ( mPassword->text() != mPasswordRetype->text() ) { - KMessageBox::error( this, i18n( "The two passwords differ!" ) ); - return; - } - - mJob = Scalix::setPassword( Settings::self()->globalSlave(), Settings::self()->accountUrl(), - Settings::self()->accountPassword(), mPassword->text() ); - connect( mJob, TQT_SIGNAL( result( TDEIO::Job* ) ), this, TQT_SLOT( finished( TDEIO::Job* ) ) ); - - updateState( true ); - } else { - mJob->kill(); - mJob = 0; - - updateState( false ); - } -} - -void PasswordPage::updateState( bool isWorking ) -{ - if ( isWorking ) { - mPassword->setEnabled( false ); - mPasswordRetype->setEnabled( false ); - mButton->setText( i18n( "Stop" ) ); - } else { - mPassword->setEnabled( true ); - mPasswordRetype->setEnabled( true ); - mButton->setText( i18n( "Change" ) ); - } -} - -void PasswordPage::textChanged() -{ - mButton->setEnabled( !mPassword->text().isEmpty() && - !mPasswordRetype->text().isEmpty() ); -} - -void PasswordPage::finished( TDEIO::Job* job ) -{ - mJob = 0; - - updateState( false ); - - if ( job->error() ) { - KMessageBox::error( this, i18n( "Unable to change the password" ) + "\n" + job->errorString() ); - return; - } - - // Update configuration files to the new password as well - - const TQString newPassword = mPassword->text(); - - { // ScalixAdmin config - TDEConfig config( "scalixadminrc" ); - TDEConfigGroup group( &config, "Account" ); - group.writeEntry( "pass", KStringHandler::obscure( newPassword ) ); - } - - { // ScalixWizard config - TDEConfig config( "scalixrc" ); - TDEConfigGroup group( &config, "General" ); - group.writeEntry( "Password", KStringHandler::obscure( newPassword ) ); - } - - { // KMail config - TDEConfig config( "kmailrc" ); - - // Try to find account group for Scalix - TQString scalixAccount; - const TQStringList groupList = config.groupList(); - for ( uint i = 0; i < groupList.count(); ++i ) { - if ( groupList[ i ].startsWith( "Account " ) ) { - TDEConfigGroup group( &config, groupList[ i ] ); - if ( group.hasKey( "groupwareType" ) && group.readNumEntry( "groupwareType" ) == 2 ) { - scalixAccount = groupList[ i ]; - break; - } - } - } - - if ( scalixAccount.isEmpty() ) { - tqWarning( "No Scalix Groupware Account found in kmailrc!" ); - return; - } - - const int accountId = scalixAccount.mid( 8 ).toInt(); - - TDEConfigGroup group( &config, scalixAccount ); - - // Save only if the user choose it before - bool storePassword = group.readBoolEntry( "store-passwd", false ); - if ( storePassword ) { - // First try to store in KWallet - if ( KWallet::Wallet::isEnabled() ) { - WId window = 0; - if ( tqApp->activeWindow() ) - window = tqApp->activeWindow()->winId(); - - KWallet::Wallet *wallet = KWallet::Wallet::openWallet( KWallet::Wallet::NetworkWallet(), window ); - if ( wallet ) { - if ( !wallet->hasFolder( "kmail" ) ) - wallet->createFolder( "kmail" ); - wallet->setFolder( "kmail" ); - wallet->writePassword( "account-" + TQString::number( accountId ), newPassword ); - } - } else { - group.writeEntry( "pass", KStringHandler::obscure( newPassword ) ); - } - - TDEConfigGroup fileGroup( &config, TQString( "Folder-%1" ).arg( group.readNumEntry( "Folder" ) ) ); - fileGroup.writeEntry( "pass", KStringHandler::obscure( newPassword ) ); - } - } - - KMessageBox::information( this, i18n( "Password was changed successfully" ) ); -} - -#include "passwordpage.moc" diff --git a/kresources/scalix/scalixadmin/passwordpage.h b/kresources/scalix/scalixadmin/passwordpage.h deleted file mode 100644 index 5255193e8..000000000 --- a/kresources/scalix/scalixadmin/passwordpage.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 PASSWORDPAGE_H -#define PASSWORDPAGE_H - -#include - -class TQLineEdit; -class TQPushButton; - -namespace TDEIO { -class Job; -} - -class PasswordPage : public TQWidget -{ - Q_OBJECT - - - public: - PasswordPage( TQWidget *parent = 0 ); - - private slots: - void buttonClicked(); - void finished( TDEIO::Job* ); - void textChanged(); - - private: - void updateState( bool ); - - TQLineEdit *mPassword; - TQLineEdit *mPasswordRetype; - TQPushButton *mButton; - - TDEIO::Job *mJob; -}; - -#endif diff --git a/kresources/scalix/scalixadmin/settings.cpp b/kresources/scalix/scalixadmin/settings.cpp deleted file mode 100644 index 279491c5f..000000000 --- a/kresources/scalix/scalixadmin/settings.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 -#include -#include - -#include "settings.h" - -Settings* Settings::mSelf = 0; - -Settings::Settings() -{ - mSlave = TDEIO::Scheduler::getConnectedSlave( accountUrl(), - accountData() ); -} - -Settings::~Settings() -{ -} - -Settings* Settings::self() -{ - if ( !mSelf ) - mSelf = new Settings; - - return mSelf; -} - -TDEIO::MetaData Settings::accountData() const -{ - TDEConfig config( "scalixadminrc" ); - TDEConfigGroup group( &config, "Account" ); - - TDEIO::MetaData data; - data.insert( "auth", group.readEntry( "auth" ) ); - data.insert( "tls", group.readBoolEntry( "use-tls" ) ? "on" : "off" ); - - return data; -} - -KURL Settings::accountUrl() const -{ - TDEConfig config( "scalixadminrc" ); - TDEConfigGroup group( &config, "Account" ); - - KURL url; - url.setProtocol( group.readBoolEntry( "use-ssl" ) ? "imaps" : "imap" ); - url.setUser( group.readEntry( "user" ) ); - url.setPass( KStringHandler::obscure( group.readEntry( "pass" ) ) ); - url.setHost( group.readEntry( "host" ) ); - url.setPort( group.readNumEntry( "port" ) ); - - return url; -} - -TQString Settings::accountPassword() const -{ - TDEConfig config( "scalixadminrc" ); - TDEConfigGroup group( &config, "Account" ); - - return KStringHandler::obscure( group.readEntry( "pass" ) ); -} - -TDEIO::Slave* Settings::globalSlave() const -{ - return mSlave; -} - -TQString Settings::rulesWizardUrl() const -{ - TDEConfig config( "scalixadminrc" ); - TDEConfigGroup group( &config, "Misc" ); - - TQString url = group.readEntry( "rulesWizardUrl" ); - if ( url.isEmpty() ) { - TDEConfigGroup group( &config, "Account" ); - url = TQString( "http://%1/Scalix/rw/?username=%2" ).arg( group.readEntry( "host" ) ) - .arg( group.readEntry( "user" ) ); - } - - return url; -} - -TQString Settings::ldapHost() const -{ - TDEConfig config( "scalixadminrc" ); - TDEConfigGroup group( &config, "LDAP" ); - return group.readEntry( "host" ); -} - -TQString Settings::ldapPort() const -{ - TDEConfig config( "scalixadminrc" ); - TDEConfigGroup group( &config, "LDAP" ); - return group.readEntry( "port" ); -} - -TQString Settings::ldapBase() const -{ - TDEConfig config( "scalixadminrc" ); - TDEConfigGroup group( &config, "LDAP" ); - return group.readEntry( "base" ); -} - -TQString Settings::ldapBindDn() const -{ - TDEConfig config( "scalixadminrc" ); - TDEConfigGroup group( &config, "LDAP" ); - return group.readEntry( "bindDn" ); -} - -TQString Settings::ldapPassword() const -{ - TDEConfig config( "scalixadminrc" ); - TDEConfigGroup group( &config, "LDAP" ); - return group.readEntry( "password" ); -} - diff --git a/kresources/scalix/scalixadmin/settings.h b/kresources/scalix/scalixadmin/settings.h deleted file mode 100644 index 29028f3b8..000000000 --- a/kresources/scalix/scalixadmin/settings.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * This file is part of ScalixAdmin. - * - * Copyright (C) 2007 Trolltech ASA. All rights reserved. - * - * 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 SETTINGS_H -#define SETTINGS_H - -#include -#include -#include - -class Settings -{ - public: - ~Settings(); - - static Settings* self(); - - TDEIO::MetaData accountData() const; - KURL accountUrl() const; - TQString accountPassword() const; - - TDEIO::Slave *globalSlave() const; - - TQString rulesWizardUrl() const; - - TQString ldapHost() const; - TQString ldapPort() const; - TQString ldapBase() const; - TQString ldapBindDn() const; - TQString ldapPassword() const; - - private: - Settings(); - TDEIO::Slave *mSlave; - - static Settings* mSelf; -}; - -#endif diff --git a/kresources/scalix/shared/CMakeLists.txt b/kresources/scalix/shared/CMakeLists.txt deleted file mode 100644 index 28ede16e0..000000000 --- a/kresources/scalix/shared/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/../../lib - ${CMAKE_SOURCE_DIR} - ${CMAKE_SOURCE_DIR}/libtdepim - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} -) - - -##### resourcescalixshared (static) ############# - -set( KDE3_DCOPIDL_EXECUTABLE ${KDE3_DCOPIDLNG_EXECUTABLE} ) - -tde_add_library( resourcescalixshared STATIC_PIC AUTOMOC - SOURCES - resourcescalixbase.cpp kmailconnection.cpp scalixbase.cpp - subresource.cpp kmailconnection.skel - ${CMAKE_SOURCE_DIR}/kmail/kmailicalIface.stub -) diff --git a/kresources/scalix/shared/Makefile.am b/kresources/scalix/shared/Makefile.am deleted file mode 100644 index 18bcbc0d5..000000000 --- a/kresources/scalix/shared/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/kresources/lib $(all_includes) - -noinst_HEADERS = resourcescalixbase.h scalixbase.h subresource.h - -noinst_LTLIBRARIES = libresourcescalixshared.la - -libresourcescalixshared_la_SOURCES = \ - resourcescalixbase.cpp kmailconnection.cpp scalixbase.cpp \ - subresource.cpp \ - kmailconnection.skel kmailicalIface.stub -libresourcescalixshared_la_METASOURCES = AUTO -libresourcescalixshared_la_LIBADD = $(top_builddir)/libkcal/libkcal.la $(top_builddir)/libtdepim/libtdepim.la ../../lib/libkgroupwaredav.la -libresourcescalixshared_la_LDFLAGS = -no-undefined - -kmailicalIface_DCOPIDLNG = true - -kmailicalIface_DIR = $(top_srcdir)/kmail diff --git a/kresources/scalix/shared/kmailconnection.cpp b/kresources/scalix/shared/kmailconnection.cpp deleted file mode 100644 index 5a1570480..000000000 --- a/kresources/scalix/shared/kmailconnection.cpp +++ /dev/null @@ -1,281 +0,0 @@ -/* - This file is part of the scalix resource - based on the kolab resource. - - Copyright (c) 2004 Bo Thorsen - - This library 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 of the License, or (at your option) any later version. - - This library 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 library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include "kmailconnection.h" -#include "resourcescalixbase.h" - -#include -#include -#include -#include -#include - -#include "kmailicalIface_stub.h" - - -using namespace Scalix; - - -KMailConnection::KMailConnection( ResourceScalixBase* resource, - const TQCString& objId ) - : DCOPObject( objId ), mResource( resource ), mKMailIcalIfaceStub( 0 ) -{ - // Make the connection to KMail ready - mDCOPClient = new DCOPClient(); - mDCOPClient->attach(); - mDCOPClient->registerAs( objId, true ); - - kapp->dcopClient()->setNotifications( true ); - connect( kapp->dcopClient(), TQT_SIGNAL( applicationRemoved( const TQCString& ) ), - this, TQT_SLOT( unregisteredFromDCOP( const TQCString& ) ) ); -} - -KMailConnection::~KMailConnection() -{ - kapp->dcopClient()->setNotifications( false ); - delete mKMailIcalIfaceStub; - mKMailIcalIfaceStub = 0; - delete mDCOPClient; - mDCOPClient = 0; -} - -static const TQCString dcopObjectId = "KMailICalIface"; -bool KMailConnection::connectToKMail() -{ - if ( !mKMailIcalIfaceStub ) { - TQString error; - TQCString dcopService; - int result = KDCOPServiceStarter::self()-> - findServiceFor( "DCOP/ResourceBackend/IMAP", TQString(), - TQString(), &error, &dcopService ); - if ( result != 0 ) { - kdError(5650) << "Couldn't connect to the IMAP resource backend\n"; - // TODO: You might want to show "error" (if not empty) here, - // using e.g. KMessageBox - return false; - } - - mKMailIcalIfaceStub = new KMailICalIface_stub( kapp->dcopClient(), - dcopService, dcopObjectId ); - - // Attach to the KMail signals - if ( !connectKMailSignal( "incidenceAdded(TQString,TQString,TQ_UINT32,int,TQString)", - "fromKMailAddIncidence(TQString,TQString,TQ_UINT32,int,TQString)" ) ) - kdError(5650) << "DCOP connection to incidenceAdded failed" << endl; - if ( !connectKMailSignal( "incidenceDeleted(TQString,TQString,TQString)", - "fromKMailDelIncidence(TQString,TQString,TQString)" ) ) - kdError(5650) << "DCOP connection to incidenceDeleted failed" << endl; - if ( !connectKMailSignal( "signalRefresh(TQString,TQString)", - "fromKMailRefresh(TQString,TQString)" ) ) - kdError(5650) << "DCOP connection to signalRefresh failed" << endl; - if ( !connectKMailSignal( "subresourceAdded( TQString, TQString, TQString )", - "fromKMailAddSubresource( TQString, TQString, TQString )" ) ) - kdError(5650) << "DCOP connection to subresourceAdded failed" << endl; - if ( !connectKMailSignal( "subresourceDeleted(TQString,TQString)", - "fromKMailDelSubresource(TQString,TQString)" ) ) - kdError(5650) << "DCOP connection to subresourceDeleted failed" << endl; - if ( !connectKMailSignal( "asyncLoadResult(TQMap, TQString, TQString)", - "fromKMailAsyncLoadResult(TQMap, TQString, TQString)" ) ) - kdError(5650) << "DCOP connection to asyncLoadResult failed" << endl; - } - - return ( mKMailIcalIfaceStub != 0 ); -} - -bool KMailConnection::fromKMailAddIncidence( const TQString& type, - const TQString& folder, - TQ_UINT32 sernum, - int format, - const TQString& data ) -{ - if ( format != KMailICalIface::StorageXML - && format != KMailICalIface::StorageIcalVcard ) - return false; -// kdDebug(5650) << "KMailConnection::fromKMailAddIncidence( " << type << ", " -// << folder << " ). iCal:\n" << ical << endl; - return mResource->fromKMailAddIncidence( type, folder, sernum, format, data ); -} - -void KMailConnection::fromKMailDelIncidence( const TQString& type, - const TQString& folder, - const TQString& xml ) -{ -// kdDebug(5650) << "KMailConnection::fromKMailDelIncidence( " << type << ", " -// << folder << ", " << uid << " )\n"; - mResource->fromKMailDelIncidence( type, folder, xml ); -} - -void KMailConnection::fromKMailRefresh( const TQString& type, const TQString& folder ) -{ -// kdDebug(5650) << "KMailConnection::fromKMailRefresh( " << type << ", " -// << folder << " )\n"; - mResource->fromKMailRefresh( type, folder ); -} - -void KMailConnection::fromKMailAddSubresource( const TQString& type, - const TQString& resource, - const TQString& label ) -{ -// kdDebug(5650) << "KMailConnection::fromKMailAddSubresource( " << type << ", " -// << resource << " )\n"; - bool writable = true; - - // TODO: This should be told by KMail right away - if ( connectToKMail() ) - writable = mKMailIcalIfaceStub->isWritableFolder( type, resource ); - - mResource->fromKMailAddSubresource( type, resource, label, writable ); -} - -void KMailConnection::fromKMailDelSubresource( const TQString& type, - const TQString& resource ) -{ -// kdDebug(5650) << "KMailConnection::fromKMailDelSubresource( " << type << ", " -// << resource << " )\n"; - mResource->fromKMailDelSubresource( type, resource ); -} - -void KMailConnection::fromKMailAsyncLoadResult( const TQMap& map, - const TQString& type, - const TQString& folder ) -{ - mResource->fromKMailAsyncLoadResult( map, type, folder ); -} - -bool KMailConnection::connectKMailSignal( const TQCString& signal, - const TQCString& method ) -{ - return connectDCOPSignal( "kmail", dcopObjectId, signal, method, false ) - && connectDCOPSignal( "kontact", dcopObjectId, signal, method, false ); -} - -bool KMailConnection::kmailSubresources( TQValueList& lst, - const TQString& contentsType ) -{ - if ( !connectToKMail() ) - return false; - - lst = mKMailIcalIfaceStub->subresourcesKolab( contentsType ); - return mKMailIcalIfaceStub->ok(); -} - -bool KMailConnection::kmailIncidencesCount( int& count, - const TQString& mimetype, - const TQString& resource ) -{ - if ( !connectToKMail() ) - return false; - - count = mKMailIcalIfaceStub->incidencesKolabCount( mimetype, resource ); - return mKMailIcalIfaceStub->ok(); -} - -bool KMailConnection::kmailIncidences( TQMap& lst, - const TQString& mimetype, - const TQString& resource, - int startIndex, - int nbMessages ) -{ - if ( !connectToKMail() ) - return false; - - lst = mKMailIcalIfaceStub->incidencesKolab( mimetype, resource, startIndex, nbMessages ); - return mKMailIcalIfaceStub->ok(); -} - - -bool KMailConnection::kmailGetAttachment( KURL& url, - const TQString& resource, - TQ_UINT32 sernum, - const TQString& filename ) -{ - if ( !connectToKMail() ) - return false; - - url = mKMailIcalIfaceStub->getAttachment( resource, sernum, filename ); - return mKMailIcalIfaceStub->ok(); -} - -bool KMailConnection::kmailDeleteIncidence( const TQString& resource, - TQ_UINT32 sernum ) -{ - return connectToKMail() - && mKMailIcalIfaceStub->deleteIncidenceKolab( resource, sernum ) - && mKMailIcalIfaceStub->ok(); -} - -bool KMailConnection::kmailUpdate( const TQString& resource, - TQ_UINT32& sernum, - const TQString& subject, - const TQString& plainTextBody, - const TQMap& customHeaders, - const TQStringList& attachmentURLs, - const TQStringList& attachmentMimetypes, - const TQStringList& attachmentNames, - const TQStringList& deletedAttachments ) -{ - //kdDebug(5006) << kdBacktrace() << endl; - if ( connectToKMail() ) { - sernum = mKMailIcalIfaceStub->update( resource, sernum, subject, plainTextBody, customHeaders, - attachmentURLs, attachmentMimetypes, attachmentNames, - deletedAttachments ); - return sernum && mKMailIcalIfaceStub->ok(); - } else - return false; -} - -bool KMailConnection::kmailStorageFormat( KMailICalIface::StorageFormat& type, - const TQString& folder ) -{ - bool ok = connectToKMail(); - type = mKMailIcalIfaceStub->storageFormat( folder ); - return ok && mKMailIcalIfaceStub->ok(); -} - - -bool KMailConnection::kmailTriggerSync( const TQString &contentsType ) -{ - bool ok = connectToKMail(); - return ok && mKMailIcalIfaceStub->triggerSync( contentsType ); -} - -void KMailConnection::unregisteredFromDCOP( const TQCString& appId ) -{ - if ( mKMailIcalIfaceStub && mKMailIcalIfaceStub->app() == appId ) { - // Delete the stub so that the next time we need to talk to kmail, - // we'll know that we need to start a new one. - delete mKMailIcalIfaceStub; - mKMailIcalIfaceStub = 0; - } -} - -#include "kmailconnection.moc" diff --git a/kresources/scalix/shared/kmailconnection.h b/kresources/scalix/shared/kmailconnection.h deleted file mode 100644 index 7fec6274f..000000000 --- a/kresources/scalix/shared/kmailconnection.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - This file is part of the scalix resource - based on the kolab resource. - - Copyright (c) 2004 Bo Thorsen - - This library 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 of the License, or (at your option) any later version. - - This library 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 library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef KMAILCONNECTION_H -#define KMAILCONNECTION_H - -#include -#include - -class KURL; -class DCOPClient; -class KMailICalIface_stub; - -namespace Scalix { - -class ResourceScalixBase; - -/** - This class provides the kmail connectivity for IMAP resources. -*/ -class KMailConnection : public TQObject, public DCOPObject { - Q_OBJECT -// - K_DCOP - - // These are the methods called by KMail when the resource changes -k_dcop: - bool fromKMailAddIncidence( const TQString& type, const TQString& resource, - TQ_UINT32 sernum, int format, const TQString& xml ); - void fromKMailDelIncidence( const TQString& type, const TQString& resource, - const TQString& xml ); - void fromKMailRefresh( const TQString& type, const TQString& resource ); - void fromKMailAddSubresource( const TQString& type, const TQString& resource, const TQString& label ); - void fromKMailDelSubresource( const TQString& type, const TQString& resource ); - void fromKMailAsyncLoadResult( const TQMap& map, const TQString& type, - const TQString& folder ); - -public: - KMailConnection( ResourceScalixBase* resource, const TQCString& objId ); - virtual ~KMailConnection(); - - /** - * Do the connection to KMail. - */ - bool connectToKMail(); - - // Call the DCOP methods - bool kmailSubresources( TQValueList& lst, - const TQString& contentsType ); - bool kmailIncidencesCount( int& count, - const TQString& mimetype, - const TQString& resource ); - bool kmailIncidences( TQMap& lst, const TQString& mimetype, - const TQString& resource, - int startIndex, - int nbMessages ); - - bool kmailGetAttachment( KURL& url, const TQString& resource, TQ_UINT32 sernum, - const TQString& filename ); - bool kmailDeleteIncidence( const TQString& resource, TQ_UINT32 sernum ); - bool kmailUpdate( const TQString& resource, - TQ_UINT32& sernum, - const TQString& subject, - const TQString& plainTextBody, - const TQMap& customHeaders, - const TQStringList& attachmentURLs, - const TQStringList& attachmentMimetypes, - const TQStringList& attachmentNames, - const TQStringList& deletedAttachments ); - - bool kmailStorageFormat( KMailICalIface::StorageFormat& type, const TQString& folder); - - bool kmailTriggerSync( const TQString& contentsType ); - -private slots: - virtual void unregisteredFromDCOP( const TQCString& ); - -private: - /** Connect a signal from KMail to a local slot. */ - bool connectKMailSignal( const TQCString&, const TQCString& ); - - ResourceScalixBase* mResource; - DCOPClient* mDCOPClient; - KMailICalIface_stub* mKMailIcalIfaceStub; -}; - -} - -#endif // KMAILCONNECTION_H diff --git a/kresources/scalix/shared/resourcescalixbase.cpp b/kresources/scalix/shared/resourcescalixbase.cpp deleted file mode 100644 index de1aa9159..000000000 --- a/kresources/scalix/shared/resourcescalixbase.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* - This file is part of the scalix resource - based on the kolab resource. - - Copyright (c) 2004 Bo Thorsen - - This library 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 of the License, or (at your option) any later version. - - This library 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 library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include "resourcescalixbase.h" -#include "kmailconnection.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace Scalix; - -static unsigned int uniquifier = 0; - -ResourceScalixBase::ResourceScalixBase( const TQCString& objId ) - : mSilent( false ) -{ - TDEGlobal::locale()->insertCatalogue( "kres_scalix" ); - TDEGlobal::locale()->insertCatalogue( "libkcal" ); - TQString uniqueObjId = TQString( objId ) + TQString::number( uniquifier++ ); - mConnection = new KMailConnection( this, uniqueObjId.utf8() ); -} - -ResourceScalixBase::~ResourceScalixBase() -{ - delete mConnection; -} - - -bool ResourceScalixBase::kmailSubresources( TQValueList& lst, - const TQString& contentsType ) const -{ - return mConnection->kmailSubresources( lst, contentsType ); -} - -bool ResourceScalixBase::kmailTriggerSync( const TQString& contentsType ) const -{ - return mConnection->kmailTriggerSync( contentsType ); -} - - -bool ResourceScalixBase::kmailIncidencesCount( int &count, - const TQString& mimetype, - const TQString& resource ) const -{ - return mConnection->kmailIncidencesCount( count, mimetype, resource ); -} - -bool ResourceScalixBase::kmailIncidences( TQMap& lst, - const TQString& mimetype, - const TQString& resource, - int startIndex, - int nbMessages ) const -{ - return mConnection->kmailIncidences( lst, mimetype, resource, startIndex, nbMessages ); -} - -bool ResourceScalixBase::kmailGetAttachment( KURL& url, const TQString& resource, - TQ_UINT32 sernum, - const TQString& filename ) const -{ - return mConnection->kmailGetAttachment( url, resource, sernum, filename ); -} - -bool ResourceScalixBase::kmailDeleteIncidence( const TQString& resource, - TQ_UINT32 sernum ) -{ - return mSilent || mConnection->kmailDeleteIncidence( resource, sernum ); -} - -bool ResourceScalixBase::kmailUpdate( const TQString& resource, - TQ_UINT32& sernum, - const TQString& xml, - const TQString& mimetype, - const TQString& subject, - const CustomHeaderMap& _customHeaders, - const TQStringList& _attachmentURLs, - const TQStringList& _attachmentMimetypes, - const TQStringList& _attachmentNames, - const TQStringList& deletedAttachments ) -{ - if ( mSilent ) - return true; - - TQString subj = subject; - if ( subj.isEmpty() ) - subj = i18n("Internal kolab data: Do not delete this mail."); - - // ical style, simply put the data inline - return mConnection->kmailUpdate( resource, sernum, subj, xml, _customHeaders, - _attachmentURLs, _attachmentMimetypes, _attachmentNames, deletedAttachments ); -} - -TQString ResourceScalixBase::configFile( const TQString& type ) const -{ - return locateLocal( "config", - TQString( "kresources/scalix/%1rc" ).arg( type ) ); -} - -bool ResourceScalixBase::connectToKMail() const -{ - return mConnection->connectToKMail(); -} - -TQString ResourceScalixBase::findWritableResource( const ResourceMap& resources ) -{ - // I have to use the label (shown in the dialog) as key here. But given how the - // label is made up, it should be unique. If it's not, well the dialog would suck anyway... - TQMap possible; - TQStringList labels; - ResourceMap::ConstIterator it; - for ( it = resources.begin(); it != resources.end(); ++it ) { - if ( it.data().writable() && it.data().active() ) { - // Writable and active possibility - possible[ it.data().label() ] = it.key(); - } - } - - if ( possible.isEmpty() ) { // None found!! - kdWarning(5650) << "No writable resource found!" << endl; - KMessageBox::error( 0, i18n( "No writable resource was found, saving will not be possible. Reconfigure KMail first." ) ); - return TQString(); - } - if ( possible.count() == 1 ) - // Just one found - return possible.begin().data(); // yes this is the subresource key, i.e. location - - // Several found, ask the user - TQString chosenLabel = KPIM::FolderSelectDialog::getItem( i18n( "Select Resource Folder" ), - i18n( "You have more than one writable resource folder. " - "Please select the one you want to write to." ), - possible.keys() ); - if ( chosenLabel.isEmpty() ) // cancelled - return TQString(); - return possible[chosenLabel]; -} - -KMailICalIface::StorageFormat ResourceScalixBase::kmailStorageFormat( const TQString &folder ) const -{ - KMailICalIface::StorageFormat format = (KMailICalIface::StorageFormat) 3; - mConnection->kmailStorageFormat( format, folder ); - return format; -} diff --git a/kresources/scalix/shared/resourcescalixbase.h b/kresources/scalix/shared/resourcescalixbase.h deleted file mode 100644 index 82c6e471a..000000000 --- a/kresources/scalix/shared/resourcescalixbase.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - This file is part of the scalix resource - based on the kolab resource. - - Copyright (c) 2004 Bo Thorsen - - This library 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 of the License, or (at your option) any later version. - - This library 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 library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef RESOURCESCALIXBASE_H -#define RESOURCESCALIXBASE_H - -#include -#include -#include - -#include "subresource.h" -#include - -class TQCString; -class KURL; - -namespace Scalix { - -class KMailConnection; - -/** - This class provides the kmail connectivity for IMAP resources. - - The main methods are: - - fromKMail...() : calls made _by_ KMail to add/delete data representation in the resource. - - kmail...() : calls _into_ KMail made by the resource. - - e.g. fromKMailAddIncidence() is called by KMail - when a new iCard is there after an IMAP sync. - - By calling fromKMailAddIncidence() KMail notifies - the resource about the new incidence, so in the - addressbook a new address will appear like magic. - - e.g. kmailAddIncidence() is called by the resource when - iCard must be stored by KMail because the user has added - an address in the addressbook. - - By calling kmailAddIncidence() the resource causes - KMail to store the new address in the (IMAP) folder. -*/ -class ResourceScalixBase { -public: - ResourceScalixBase( const TQCString& objId ); - virtual ~ResourceScalixBase(); - - // These are the methods called by KMail when the resource changes - virtual bool fromKMailAddIncidence( const TQString& type, - const TQString& resource, - TQ_UINT32 sernum, - int format, - const TQString& data ) = 0; - virtual void fromKMailDelIncidence( const TQString& type, - const TQString& resource, - const TQString& xml ) = 0; - virtual void fromKMailRefresh( const TQString& type, - const TQString& resource ) = 0; - virtual void fromKMailAddSubresource( const TQString& type, - const TQString& resource, - const TQString& label, - bool writable ) = 0; - virtual void fromKMailDelSubresource( const TQString& type, - const TQString& resource ) = 0; - - virtual void fromKMailAsyncLoadResult( const TQMap& map, - const TQString& type, - const TQString& folder ) = 0; -protected: - /// Do the connection to KMail. - bool connectToKMail() const; - - // These are the KMail dcop function connections. The docs here say - // "Get", which here means that the first argument is the return arg - - /// List all folders with a certain contentsType. Returns a TQMap with - /// resourcename/writable pairs - bool kmailSubresources( TQValueList& lst, - const TQString& contentsType ) const; - - /// Get the number of messages in this folder. - /// Used to iterate over kmailIncidences by chunks - bool kmailIncidencesCount( int& count, const TQString& mimetype, - const TQString& resource ) const; - - /// Get the mimetype attachments from a chunk of messages from this folder. - /// Returns a TQMap with serialNumber/attachment pairs. - bool kmailIncidences( TQMap& lst, const TQString& mimetype, - const TQString& resource, - int startIndex, - int nbMessages ) const; - - bool kmailTriggerSync( const TQString& contentType ) const; - -public: // for Contact - /// Get an attachment from a mail. Returns a URL to it. This can - /// be called by the resource after obtaining the incidence. - /// The resource must delete the temp file. - bool kmailGetAttachment( KURL& url, const TQString& resource, - TQ_UINT32 sernum, - const TQString& filename ) const; - -protected: - /// Delete an incidence. - bool kmailDeleteIncidence( const TQString& resource, TQ_UINT32 sernum ); - - KMailICalIface::StorageFormat kmailStorageFormat( const TQString& folder ) const; - - typedef TQMap CustomHeaderMap; - - /// Update an incidence. The list of attachments are URLs. - /// The parameter sernum is updated with the right KMail serial number - bool kmailUpdate( const TQString& resource, TQ_UINT32& sernum, - const TQString& xml, - const TQString& mimetype, - const TQString& subject, - const CustomHeaderMap& customHeaders = CustomHeaderMap(), - const TQStringList& attachmentURLs = TQStringList(), - const TQStringList& attachmentMimetypes = TQStringList(), - const TQStringList& attachmentNames = TQStringList(), - const TQStringList& deletedAttachments = TQStringList() ); - - /// Get the full path of the config file. - TQString configFile( const TQString& type ) const; - - /// If only one of these is writable, return that. Otherwise return null. - TQString findWritableResource( const ResourceMap& resources ); - - bool mSilent; - - /** - * This is used to store a mapping from the XML UID to the KMail - * serial number of the mail it's stored in. That provides a quick way - * to access the storage in KMail. - */ - UidMap mUidMap; - - /// This is used to distinguish operations triggered by the user, - /// from operations triggered by KMail - TQStringList mUidsPendingAdding; - TQStringList mUidsPendingDeletion; - TQStringList mUidsPendingUpdate; - -private: - mutable KMailConnection* mConnection; -}; - -} - -#endif // RESOURCEKOLABBASE_H diff --git a/kresources/scalix/shared/scalixbase.cpp b/kresources/scalix/shared/scalixbase.cpp deleted file mode 100644 index d40bdb03f..000000000 --- a/kresources/scalix/shared/scalixbase.cpp +++ /dev/null @@ -1,446 +0,0 @@ -/* - This file is part of the scalix resource - based on the kolab resource. - - Copyright (c) 2004 Bo Thorsen - - This library 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 of the License, or (at your option) any later version. - - This library 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 library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include "scalixbase.h" - -#include -#include -#include -#include -#include - -using namespace Scalix; - - -ScalixBase::ScalixBase( const TQString& tz ) - : mCreationDate( TQDateTime::currentDateTime() ), - mLastModified( TQDateTime::currentDateTime() ), - mSensitivity( Public ), mTimeZoneId( tz ), - mHasPilotSyncId( false ), mHasPilotSyncStatus( false ) -{ -} - -ScalixBase::~ScalixBase() -{ -} - -void ScalixBase::setFields( const KCal::Incidence* incidence ) -{ - // So far unhandled KCal::IncidenceBase fields: - // mPilotID, mSyncStatus, mFloats - - setUid( incidence->uid() ); - setBody( incidence->description() ); - setCategories( incidence->categoriesStr() ); - setCreationDate( localToUTC( incidence->created() ) ); - setLastModified( localToUTC( incidence->lastModified() ) ); - setSensitivity( static_cast( incidence->secrecy() ) ); - // TODO: Attachments -} - -void ScalixBase::saveTo( KCal::Incidence* incidence ) const -{ - incidence->setUid( uid() ); - incidence->setDescription( body() ); - incidence->setCategories( categories() ); - incidence->setCreated( utcToLocal( creationDate() ) ); - incidence->setLastModified( utcToLocal( lastModified() ) ); - incidence->setSecrecy( sensitivity() ); - // TODO: Attachments -} - -void ScalixBase::setFields( const KABC::Addressee* addressee ) -{ - // An addressee does not have a creation date, so somehow we should - // make one, if this is a new entry - - setUid( addressee->uid() ); - setBody( addressee->note() ); - setCategories( addressee->categories().join( "," ) ); - - // Set creation-time and last-modification-time - const TQString creationString = addressee->custom( "KOLAB", "CreationDate" ); - kdDebug(5006) << "Creation time string: " << creationString << endl; - TQDateTime creationDate; - if ( creationString.isEmpty() ) { - creationDate = TQDateTime::currentDateTime(); - kdDebug(5006) << "Creation date set to current time\n"; - } - else { - creationDate = stringToDateTime( creationString ); - kdDebug(5006) << "Creation date loaded\n"; - } - TQDateTime modified = addressee->revision(); - if ( !modified.isValid() ) - modified = TQDateTime::currentDateTime(); - setLastModified( modified ); - if ( modified < creationDate ) { - // It's not possible that the modification date is earlier than creation - creationDate = modified; - kdDebug(5006) << "Creation date set to modification date\n"; - } - setCreationDate( creationDate ); - const TQString newCreationDate = dateTimeToString( creationDate ); - if ( creationString != newCreationDate ) { - // We modified the creation date, so store it for future reference - const_cast( addressee ) - ->insertCustom( "KOLAB", "CreationDate", newCreationDate ); - kdDebug(5006) << "Creation date modified. New one: " << newCreationDate << endl; - } - - switch( addressee->secrecy().type() ) { - case KABC::Secrecy::Private: - setSensitivity( Private ); - break; - case KABC::Secrecy::Confidential: - setSensitivity( Confidential ); - break; - default: - setSensitivity( Public ); - } - - // TODO: Attachments -} - -void ScalixBase::saveTo( KABC::Addressee* addressee ) const -{ - addressee->setUid( uid() ); - addressee->setNote( body() ); - addressee->setCategories( TQStringList::split( ',', categories() ) ); - addressee->setRevision( lastModified() ); - addressee->insertCustom( "KOLAB", "CreationDate", - dateTimeToString( creationDate() ) ); - - switch( sensitivity() ) { - case Private: - addressee->setSecrecy( KABC::Secrecy( KABC::Secrecy::Private ) ); - break; - case Confidential: - addressee->setSecrecy( KABC::Secrecy( KABC::Secrecy::Confidential ) ); - break; - default: - addressee->setSecrecy( KABC::Secrecy( KABC::Secrecy::Public ) ); - break; - } - - // TODO: Attachments -} - -void ScalixBase::setUid( const TQString& uid ) -{ - mUid = uid; -} - -TQString ScalixBase::uid() const -{ - return mUid; -} - -void ScalixBase::setBody( const TQString& body ) -{ - mBody = body; -} - -TQString ScalixBase::body() const -{ - return mBody; -} - -void ScalixBase::setCategories( const TQString& categories ) -{ - mCategories = categories; -} - -TQString ScalixBase::categories() const -{ - return mCategories; -} - -void ScalixBase::setCreationDate( const TQDateTime& date ) -{ - mCreationDate = date; -} - -TQDateTime ScalixBase::creationDate() const -{ - return mCreationDate; -} - -void ScalixBase::setLastModified( const TQDateTime& date ) -{ - mLastModified = date; -} - -TQDateTime ScalixBase::lastModified() const -{ - return mLastModified; -} - -void ScalixBase::setSensitivity( Sensitivity sensitivity ) -{ - mSensitivity = sensitivity; -} - -ScalixBase::Sensitivity ScalixBase::sensitivity() const -{ - return mSensitivity; -} - -void ScalixBase::setPilotSyncId( unsigned long id ) -{ - mHasPilotSyncId = true; - mPilotSyncId = id; -} - -bool ScalixBase::hasPilotSyncId() const -{ - return mHasPilotSyncId; -} - -unsigned long ScalixBase::pilotSyncId() const -{ - return mPilotSyncId; -} - -void ScalixBase::setPilotSyncStatus( int status ) -{ - mHasPilotSyncStatus = true; - mPilotSyncStatus = status; -} - -bool ScalixBase::hasPilotSyncStatus() const -{ - return mHasPilotSyncStatus; -} - -int ScalixBase::pilotSyncStatus() const -{ - return mPilotSyncStatus; -} - -bool ScalixBase::loadEmailAttribute( TQDomElement& element, Email& email ) -{ - for ( TQDomNode n = element.firstChild(); !n.isNull(); n = n.nextSibling() ) { - if ( n.isComment() ) - continue; - if ( n.isElement() ) { - TQDomElement e = n.toElement(); - TQString tagName = e.tagName(); - - if ( tagName == "display-name" ) - email.displayName = e.text(); - else if ( tagName == "smtp-address" ) - email.smtpAddress = e.text(); - else - // TODO: Unhandled tag - save for later storage - kdDebug() << "Warning: Unhandled tag " << e.tagName() << endl; - } else - kdDebug() << "Node is not a comment or an element???" << endl; - } - - return true; -} - -void ScalixBase::saveEmailAttribute( TQDomElement& element, const Email& email, - const TQString& tagName ) const -{ - TQDomElement e = element.ownerDocument().createElement( tagName ); - element.appendChild( e ); - writeString( e, "display-name", email.displayName ); - writeString( e, "smtp-address", email.smtpAddress ); -} - -bool ScalixBase::loadAttribute( TQDomElement& element ) -{ - TQString tagName = element.tagName(); - - if ( tagName == "uid" ) - setUid( element.text() ); - else if ( tagName == "body" ) - setBody( element.text() ); - else if ( tagName == "categories" ) - setCategories( element.text() ); - else if ( tagName == "creation-date" ) - setCreationDate( stringToDateTime( element.text() ) ); - else if ( tagName == "last-modification-date" ) - setLastModified( stringToDateTime( element.text() ) ); - else if ( tagName == "sensitivity" ) - setSensitivity( stringToSensitivity( element.text() ) ); - else if ( tagName == "product-id" ) - return true; // ignore this field - else if ( tagName == "pilot-sync-id" ) - setPilotSyncId( element.text().toULong() ); - else if ( tagName == "pilot-sync-status" ) - setPilotSyncStatus( element.text().toInt() ); - else - return false; - - // Handled here - return true; -} - -bool ScalixBase::saveAttributes( TQDomElement& element ) const -{ - writeString( element, "product-id", productID() ); - writeString( element, "uid", uid() ); - writeString( element, "body", body() ); - writeString( element, "categories", categories() ); - writeString( element, "creation-date", dateTimeToString( creationDate() ) ); - writeString( element, "last-modification-date", - dateTimeToString( lastModified() ) ); - writeString( element, "sensitivity", sensitivityToString( sensitivity() ) ); - if ( hasPilotSyncId() ) - writeString( element, "pilot-sync-id", TQString::number( pilotSyncId() ) ); - if ( hasPilotSyncStatus() ) - writeString( element, "pilot-sync-status", TQString::number( pilotSyncStatus() ) ); - return true; -} - -bool ScalixBase::load( const TQString& xml ) -{ - TQString errorMsg; - int errorLine, errorColumn; - TQDomDocument document; - bool ok = document.setContent( xml, &errorMsg, &errorLine, &errorColumn ); - - if ( !ok ) { - tqWarning( "Error loading document: %s, line %d, column %d", - errorMsg.latin1(), errorLine, errorColumn ); - return false; - } - - // XML file loaded into tree. Now parse it - return loadXML( document ); -} - -bool ScalixBase::load( TQFile& xml ) -{ - TQString errorMsg; - int errorLine, errorColumn; - TQDomDocument document; - bool ok = document.setContent( &xml, &errorMsg, &errorLine, &errorColumn ); - - if ( !ok ) { - tqWarning( "Error loading document: %s, line %d, column %d", - errorMsg.latin1(), errorLine, errorColumn ); - return false; - } - - // XML file loaded into tree. Now parse it - return loadXML( document ); -} - -TQDomDocument ScalixBase::domTree() -{ - TQDomDocument document; - - TQString p = "version=\"1.0\" encoding=\"UTF-8\""; - document.appendChild(document.createProcessingInstruction( "xml", p ) ); - - return document; -} - - -TQString ScalixBase::dateTimeToString( const TQDateTime& time ) -{ - return time.toString( Qt::ISODate ) + 'Z'; -} - -TQString ScalixBase::dateToString( const TQDate& date ) -{ - return date.toString( Qt::ISODate ); -} - -TQDateTime ScalixBase::stringToDateTime( const TQString& _date ) -{ - TQString date( _date ); - if ( date.endsWith( "Z" ) ) - date.truncate( date.length() - 1 ); - return TQDateTime::fromString( date, Qt::ISODate ); -} - -TQDate ScalixBase::stringToDate( const TQString& date ) -{ - return TQDate::fromString( date, Qt::ISODate ); -} - -TQString ScalixBase::sensitivityToString( Sensitivity s ) -{ - switch( s ) { - case Private: return "private"; - case Confidential: return "confidential"; - case Public: return "public"; - } - - return "What what what???"; -} - -ScalixBase::Sensitivity ScalixBase::stringToSensitivity( const TQString& s ) -{ - if ( s == "private" ) - return Private; - if ( s == "confidential" ) - return Confidential; - return Public; -} - -TQString ScalixBase::colorToString( const TQColor& color ) -{ - // Color is in the format "#RRGGBB" - return color.name(); -} - -TQColor ScalixBase::stringToColor( const TQString& s ) -{ - return TQColor( s ); -} - -void ScalixBase::writeString( TQDomElement& element, const TQString& tag, - const TQString& tagString ) -{ - if ( !tagString.isEmpty() ) { - TQDomElement e = element.ownerDocument().createElement( tag ); - TQDomText t = element.ownerDocument().createTextNode( tagString ); - e.appendChild( t ); - element.appendChild( e ); - } -} - -TQDateTime ScalixBase::localToUTC( const TQDateTime& time ) const -{ - return KPimPrefs::localTimeToUtc( time, mTimeZoneId ); -} - -TQDateTime ScalixBase::utcToLocal( const TQDateTime& time ) const -{ - return KPimPrefs::utcToLocalTime( time, mTimeZoneId ); -} diff --git a/kresources/scalix/shared/scalixbase.h b/kresources/scalix/shared/scalixbase.h deleted file mode 100644 index 7bff80a4b..000000000 --- a/kresources/scalix/shared/scalixbase.h +++ /dev/null @@ -1,176 +0,0 @@ -/* - This file is part of the scalix resource - based on the kolab resource. - - Copyright (c) 2004 Bo Thorsen - - This library 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 of the License, or (at your option) any later version. - - This library 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 library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef SCALIXBASE_H -#define SCALIXBASE_H - -#include -#include -#include - -class TQFile; - -namespace KCal { - class Incidence; -} - -namespace KABC { - class Addressee; -} - -namespace Scalix { - -class ScalixBase { -public: - struct Email { - public: - Email( const TQString& name = TQString(), - const TQString& email = TQString() ) - : displayName( name ), smtpAddress( email ) - { - } - - TQString displayName; - TQString smtpAddress; - }; - - enum Sensitivity { Public = 0, Private = 1, Confidential = 2 }; - - explicit ScalixBase( const TQString& timezone = TQString() ); - virtual ~ScalixBase(); - - // Return a string identifying this type - virtual TQString type() const = 0; - - virtual void setUid( const TQString& uid ); - virtual TQString uid() const; - - virtual void setBody( const TQString& body ); - virtual TQString body() const; - - virtual void setCategories( const TQString& categories ); - virtual TQString categories() const; - - virtual void setCreationDate( const TQDateTime& date ); - virtual TQDateTime creationDate() const; - - virtual void setLastModified( const TQDateTime& date ); - virtual TQDateTime lastModified() const; - - virtual void setSensitivity( Sensitivity sensitivity ); - virtual Sensitivity sensitivity() const; - - virtual void setPilotSyncId( unsigned long id ); - virtual bool hasPilotSyncId() const; - virtual unsigned long pilotSyncId() const; - - virtual void setPilotSyncStatus( int status ); - virtual bool hasPilotSyncStatus() const; - virtual int pilotSyncStatus() const; - - // String - Date conversion methods - static TQString dateTimeToString( const TQDateTime& time ); - static TQString dateToString( const TQDate& date ); - static TQDateTime stringToDateTime( const TQString& time ); - static TQDate stringToDate( const TQString& date ); - - // String - Sensitivity conversion methods - static TQString sensitivityToString( Sensitivity ); - static Sensitivity stringToSensitivity( const TQString& ); - - // String - Color conversion methods - static TQString colorToString( const TQColor& ); - static TQColor stringToColor( const TQString& ); - - // Load this object by reading the XML file - bool load( const TQString& xml ); - bool load( TQFile& xml ); - - // Load this TQDomDocument - virtual bool loadXML( const TQDomDocument& xml ) = 0; - - // Serialize this object to an XML string - virtual TQString saveXML() const = 0; - -protected: - /// Read all known fields from this ical incidence - void setFields( const KCal::Incidence* ); - - /// Save all known fields into this ical incidence - void saveTo( KCal::Incidence* ) const; - - /// Read all known fields from this contact - void setFields( const KABC::Addressee* ); - - /// Save all known fields into this contact - void saveTo( KABC::Addressee* ) const; - - // This just makes the initial dom tree with version and doctype - static TQDomDocument domTree(); - - bool loadEmailAttribute( TQDomElement& element, Email& email ); - - void saveEmailAttribute( TQDomElement& element, const Email& email, - const TQString& tagName = "email" ) const; - - // Load the attributes of this class - virtual bool loadAttribute( TQDomElement& ); - - // Save the attributes of this class - virtual bool saveAttributes( TQDomElement& ) const; - - // Return the product ID - virtual TQString productID() const = 0; - - // Write a string tag - static void writeString( TQDomElement&, const TQString&, const TQString& ); - - TQDateTime localToUTC( const TQDateTime& time ) const; - TQDateTime utcToLocal( const TQDateTime& time ) const; - - TQString mUid; - TQString mBody; - TQString mCategories; - TQDateTime mCreationDate; - TQDateTime mLastModified; - Sensitivity mSensitivity; - TQString mTimeZoneId; - - // KPilot synchronization stuff - bool mHasPilotSyncId, mHasPilotSyncStatus; - unsigned long mPilotSyncId; - int mPilotSyncStatus; -}; - -} - -#endif // SCALIXBASE_H diff --git a/kresources/scalix/shared/subresource.cpp b/kresources/scalix/shared/subresource.cpp deleted file mode 100644 index bd3fdd8aa..000000000 --- a/kresources/scalix/shared/subresource.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - This file is part of the scalix resource - based on the kolab resource. - - Copyright (c) 2004 Klarlvdalens Datakonsult AB - - - This library 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 of the License, or (at your option) any later version. - - This library 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 library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include "subresource.h" - -using namespace Scalix; - -SubResource::SubResource( bool active, bool writable, const TQString& label, - int completionWeight ) - : mActive( active ), mWritable( writable ), mLabel( label ), - mCompletionWeight( completionWeight ) -{ -} - -SubResource::~SubResource() -{ -} - -void SubResource::setActive( bool active ) -{ - mActive = active; -} - -bool SubResource::active() const -{ - return mActive; -} - -void SubResource::setWritable( bool writable ) -{ - mWritable = writable; -} - -bool SubResource::writable() const -{ - return mWritable; -} - -void SubResource::setLabel( const TQString& label ) -{ - mLabel = label; -} - -TQString SubResource::label() const -{ - return mLabel; -} - -void SubResource::setCompletionWeight( int completionWeight ) -{ - mCompletionWeight = completionWeight; -} - -int SubResource::completionWeight() const -{ - return mCompletionWeight; -} - -StorageReference::StorageReference( const TQString& resource, TQ_UINT32 sernum ) - : mResource( resource ), mSerialNumber( sernum ) -{ -} - -StorageReference::~StorageReference() -{ -} - -void StorageReference::setResource( const TQString& resource ) -{ - mResource = resource; -} - -TQString StorageReference::resource() const -{ - return mResource; -} - -void StorageReference::setSerialNumber( TQ_UINT32 serialNumber ) -{ - mSerialNumber = serialNumber; -} - -TQ_UINT32 StorageReference::serialNumber() const -{ - return mSerialNumber; -} diff --git a/kresources/scalix/shared/subresource.h b/kresources/scalix/shared/subresource.h deleted file mode 100644 index 3fcb6b03c..000000000 --- a/kresources/scalix/shared/subresource.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - This file is part of the scalix resource - based on the kolab resource. - - Copyright (c) 2004 Klarlvdalens Datakonsult AB - - - This library 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 of the License, or (at your option) any later version. - - This library 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 library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the TQt library by Trolltech AS, Norway (or with modified versions - of TQt that use the same license as TQt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - TQt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef SUBRESOURCE_H -#define SUBRESOURCE_H - -#include -#include - - -namespace Scalix { - -/** - * This class is used to store in a map from resource id to this, providing - * a lookup of the subresource settings. - */ -class SubResource { -public: - // This is just for TQMap - SubResource() {} - - SubResource( bool active, bool writable, const TQString& label, - int completionWeight = 100 ); - virtual ~SubResource(); - - virtual void setActive( bool active ); - virtual bool active() const; - - virtual void setWritable( bool writable ); - virtual bool writable() const; - - virtual void setLabel( const TQString& label ); - virtual TQString label() const; - - virtual void setCompletionWeight( int completionWeight ); - virtual int completionWeight() const; - -private: - bool mActive; // Controlled by the applications - bool mWritable; // Set if the KMail folder is writable - TQString mLabel; // The GUI name of this resource - - // This is just for the abc plugin. But as long as only this is here, - // it's just as cheap to have it in here as making a d-pointer that - // subclasses could add to. If more are added, then we should refactor - // to a d-pointer instead. - int mCompletionWeight; -}; - -typedef TQMap ResourceMap; - -/** - * This class is used to store a mapping from the XML UID to the KMail - * serial number of the mail it's stored in and the resource. That provides - * a quick way to access the storage in KMail. - */ -class StorageReference { -public: - // Just for TQMap - StorageReference() {} - - StorageReference( const TQString& resource, TQ_UINT32 sernum ); - virtual ~StorageReference(); - - virtual void setResource( const TQString& resource ); - virtual TQString resource() const; - - virtual void setSerialNumber( TQ_UINT32 serialNumber ); - virtual TQ_UINT32 serialNumber() const; - -private: - TQString mResource; - TQ_UINT32 mSerialNumber; -}; - -typedef TQMap UidMap; - -} - -#endif // SUBRESOURCE_H diff --git a/kresources/scalix/uninstall.desktop b/kresources/scalix/uninstall.desktop deleted file mode 100644 index e1e3e1732..000000000 --- a/kresources/scalix/uninstall.desktop +++ /dev/null @@ -1,2 +0,0 @@ -[Desktop Entry] -Hidden=true -- cgit v1.2.1