kitchensync Library API Documentation

device.cpp

00001 /*
00002     This file is part of KitchenSync.
00003 
00004     Copyright (c) 2002,2003 Holger Freyther <freyther@kde.org>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019     Boston, MA 02111-1307, USA.
00020 */
00021 
00022 #include <addressbooksyncee.h>
00023 #include <todosyncee.h>
00024 #include <eventsyncee.h>
00025 
00026 #include "device.h"
00027 
00028 using KSync::EventSyncee;
00029 using KSync::AddressBookSyncee;
00030 using KSync::TodoSyncee;
00031 
00032 using namespace OpieHelper;
00033 
00034 Device::Device() {
00035     m_model = Opie;
00036 }
00037 Device::~Device() {
00038 }
00039 int Device::distribution()const {
00040     return m_model;
00041 }
00042 void Device::setDistribution( int dist ) {
00043     m_model = dist;
00044 }
00045 QBitArray Device::supports( enum PIM pim) const{
00046     QBitArray ar;
00047     switch( pim ) {
00048     case Calendar:
00049         ar = opieCal();
00050         break;
00051     case Addressbook:
00052         ar = opieAddr();
00053         break;
00054     case Todolist:
00055         ar = opieTo();
00056         break;
00057     }
00058     return ar;
00059 }
00060 QBitArray Device::opieCal() const{
00061     QBitArray ar( EventSyncee::DtEnd+1 );
00062     ar[EventSyncee::Organizer] = false;
00063     ar[EventSyncee::ReadOnly ] = false; // we do not support the read only attribute
00064     ar[EventSyncee::DtStart  ] = true;
00065     ar[EventSyncee::Duration ] = true;
00066     ar[EventSyncee::Float    ] = true;
00067     ar[EventSyncee::Attendee ] = false;
00068     ar[EventSyncee::CreatedDate ] = false;
00069     ar[EventSyncee::Revision ] = false;
00070     ar[EventSyncee::Description ] = true;
00071     ar[EventSyncee::Summary] = true; // ( m_model == Opie );  if we're in opie mode we do support the summary!
00072     ar[EventSyncee::Category ] = true;
00073     ar[EventSyncee::Relations ] = false;
00074     ar[EventSyncee::ExDates ] = false; // currently we do not support the Exception to Recurrence
00075     ar[EventSyncee::Attachments ] = false;
00076     ar[EventSyncee::Secrecy ] = false;
00077     ar[EventSyncee::Resources ] = false; // we do not support resources
00078     ar[EventSyncee::Priority ] = false; // no priority for calendar
00079     ar[EventSyncee::Alarms ] = false; // Opie/Qtopia alarms are so different in nature
00080     ar[EventSyncee::Recurrence ] = true; // we do not support everything though...
00081     ar[EventSyncee::Location] = true;
00082     ar[EventSyncee::DtEnd ] = true;
00083 
00084     return ar;
00085 }
00086 QBitArray Device::opieAddr() const{
00087     QBitArray ar(AddressBookSyncee::Emails +1 );
00088 
00089     ar[AddressBookSyncee::FamilyName] = true;
00090     ar[AddressBookSyncee::GivenName] = true;
00091     ar[AddressBookSyncee::AdditionalName] = true;
00092     ar[AddressBookSyncee::Prefix ] = false;
00093     ar[AddressBookSyncee::Suffix] = true;
00094     ar[AddressBookSyncee::NickName] = true;
00095     ar[AddressBookSyncee::Birthday] = true;
00096     ar[AddressBookSyncee::HomeAddress ] = true;
00097     ar[AddressBookSyncee::BusinessAddress]= true;
00098     ar[AddressBookSyncee::TimeZone] = false;
00099     ar[AddressBookSyncee::Geo ] = false;
00100     ar[AddressBookSyncee::Title ] = false;
00101     ar[AddressBookSyncee::Role ] = true;
00102     ar[AddressBookSyncee::Organization ] = true;
00103     ar[AddressBookSyncee::Note ] = true;
00104     ar[AddressBookSyncee::Url ] = false;
00105     ar[AddressBookSyncee::Secrecy ] = false;
00106     ar[AddressBookSyncee::Picture ] = false;
00107     ar[AddressBookSyncee::Sound ] = false;
00108     ar[AddressBookSyncee::Agent ] = false;
00109     ar[AddressBookSyncee::HomeNumbers] = true;
00110     ar[AddressBookSyncee::OfficeNumbers] = true;
00111     ar[AddressBookSyncee::Messenger ] = false;
00112     ar[AddressBookSyncee::PreferredNumber ] = false;
00113     ar[AddressBookSyncee::Voice ] = false;
00114     ar[AddressBookSyncee::Fax ] = false;
00115     ar[AddressBookSyncee::Cell ] = false;
00116     ar[AddressBookSyncee::Video ] = false;
00117     ar[AddressBookSyncee::Mailbox ] = false;
00118     ar[AddressBookSyncee::Modem ] = false;
00119     ar[AddressBookSyncee::CarPhone ] = false;
00120     ar[AddressBookSyncee::ISDN ] = false;
00121     ar[AddressBookSyncee::PCS ] = false;
00122     ar[AddressBookSyncee::Pager ] = false;
00123     ar[AddressBookSyncee::HomeFax] = true;
00124     ar[AddressBookSyncee::WorkFax] = true;
00125     ar[AddressBookSyncee::OtherTel] = false;
00126     ar[AddressBookSyncee::Category] = true;
00127     ar[AddressBookSyncee::Custom] = true;
00128     ar[AddressBookSyncee::Keys] = false;
00129     ar[AddressBookSyncee::Logo] = false;
00130     ar[AddressBookSyncee::Email] = true;
00131     ar[AddressBookSyncee::Emails] = true;
00132     return ar;
00133 }
00134 QBitArray Device::opieTo() const{
00135     QBitArray ar(TodoSyncee::Percent+1);
00136     ar[TodoSyncee::Organizer] = false;
00137     ar[TodoSyncee::ReadOnly] = false;
00138     ar[TodoSyncee::DtStart] = ( m_model == Opie );
00139     ar[TodoSyncee::Duration] = false;
00140     ar[TodoSyncee::Float] = false; // check if DueDate less components...
00141     ar[TodoSyncee::Attendee] = false;
00142     ar[TodoSyncee::CreatedDate] = false;
00143     ar[TodoSyncee::Revision] = false;
00144     ar[TodoSyncee::Description] = true;
00145     ar[TodoSyncee::Summary] = ( m_model == Opie );
00146     ar[TodoSyncee::Category] = true;
00147     ar[TodoSyncee::Relations] = false;
00148     ar[TodoSyncee::ExDates] = false;
00149     ar[TodoSyncee::Attachments] = false;
00150     ar[TodoSyncee::Secrecy] = false;
00151     ar[TodoSyncee::Priority] = true;
00152     ar[TodoSyncee::Alarms] = false;
00153     ar[TodoSyncee::Recurrence] = false;
00154     ar[TodoSyncee::Location] = false;
00155     ar[TodoSyncee::StartDate] = ( m_model == Opie );
00156     ar[TodoSyncee::Completed] = true;
00157     ar[TodoSyncee::Percent] = true;
00158     return ar;
00159 }
00160 QString Device::user()const {
00161     if(m_model == Opie )
00162     return m_user;
00163     else
00164     return QString::fromLatin1("root");
00165 }
00166 void Device::setUser( const QString& str ){
00167     m_user = str;
00168 }
00169 QString Device::password()const {
00170     if(m_model == Opie )
00171     return m_pass;
00172     else
00173     return QString::fromLatin1("Qtopia");
00174 }
00175 void Device::setPassword(const QString& pass ){
00176     m_pass = pass;
00177 }
00178 void Device::setMeta( const QString& str ){
00179     m_meta = str;
00180 }
00181 QString Device::meta()const{
00182     return m_meta;
00183 }
KDE Logo
This file is part of the documentation for kitchensync Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Aug 23 18:20:08 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003