Changeset 1620

Show
Ignore:
Timestamp:
01/20/07 13:29:38 (23 months ago)
Author:
mjahn
Message:

apply fix based one XMPM changes against opensync kdepim-plugin :
- 0040-cosmethics.patch,
- 0060-indentation_whitespace_cleanup.patch,
- 0080-indentation_cleanup.patch and
- 0250-big_whitespace_cleanup.patch

Location:
plugins/kdepim/src
Files:
10 modified

Legend:

Unmodified
Added
Removed
  • plugins/kdepim/src/KNotesIface.h

    r455 r1620  
    11/******************************************************************* 
    22 KNotesIface.h  --  This file defines the DCOP interface for KNotes. 
    3  
     3  
    44 Copyright (C) 2000 by Adriaan de Groot 
    55               2001-2003 by Michael Brade <brade@kde.org> 
    6  
     6  
    77 This program is free software; you can redistribute it and/or 
    88 modify it under the terms of the GNU General Public License 
    99 as published by the Free Software Foundation; either version 2 
    1010 of the License, or (at your option) any later version. 
    11  
     11  
    1212 This program is distributed in the hope that it will be useful, 
    1313 but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1414 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1515 GNU General Public License for more details. 
    16  
     16  
    1717 You should have received a copy of the GNU General Public License 
    1818 along with this program; if not, write to the Free Software 
     
    3131class KNotesIface : virtual public DCOPObject 
    3232{ 
    33     K_DCOP 
    34 k_dcop: 
    35     /** 
    36     * Create a new note. 
    37     * @param name the name (title) of the new note, if it is empty, 
    38     *        KNotes will choose an appropriate name 
    39     * @param text the body of the new note 
    40     * @return the new notes' id 
    41     */ 
    42     virtual QString newNote( const QString& name = QString::null, 
    43                              const QString& text = QString::null ) = 0; 
     33                K_DCOP 
     34        k_dcop: 
     35                /** 
     36                * Create a new note. 
     37                * @param name the name (title) of the new note, if it is empty, 
     38                *        KNotes will choose an appropriate name 
     39                * @param text the body of the new note 
     40                * @return the new notes' id 
     41                */ 
     42                virtual QString newNote( const QString& name = QString::null, 
     43                                         const QString& text = QString::null ) = 0; 
    4444 
    45     /** 
    46     * Create a new note and inserts the current text in the clipboard 
    47     * as text. 
    48     * 
    49     * @param name the name (title) of the new note, if it is empty, 
    50     *        KNotes will choose an appropriate name 
    51     * @return the new notes' id 
    52     */ 
    53     virtual QString newNoteFromClipboard( const QString& name = QString::null ) = 0; 
     45                /** 
     46                * Create a new note and inserts the current text in the clipboard 
     47                * as text. 
     48                * 
     49                * @param name the name (title) of the new note, if it is empty, 
     50                *        KNotes will choose an appropriate name 
     51                * @return the new notes' id 
     52                */ 
     53                virtual QString newNoteFromClipboard( const QString& name = QString::null ) = 0; 
    5454 
    55     /** 
    56     * Show a note as if it had been selected from the "notes" menu. 
    57     * @param noteId the id of the note to show 
    58     */ 
    59     virtual ASYNC showNote( const QString& noteId ) const = 0; 
     55                /** 
     56                * Show a note as if it had been selected from the "notes" menu. 
     57                * @param noteId the id of the note to show 
     58                */ 
     59                virtual ASYNC showNote( const QString& noteId ) const = 0; 
    6060 
    61     /** 
    62     * Hide a note. 
    63     * @param noteId the id of the note to hide 
    64     */ 
    65     virtual ASYNC hideNote( const QString& noteId ) const = 0; 
     61                /** 
     62                * Hide a note. 
     63                * @param noteId the id of the note to hide 
     64                */ 
     65                virtual ASYNC hideNote( const QString& noteId ) const = 0; 
    6666 
    67     /** 
    68     * Deletes a note forever. 
    69     * @param noteId the id of the note to kill 
    70     */ 
    71     virtual ASYNC killNote( const QString& noteId ) = 0; 
     67                /** 
     68                * Deletes a note forever. 
     69                * @param noteId the id of the note to kill 
     70                */ 
     71                virtual ASYNC killNote( const QString& noteId ) = 0; 
    7272 
    73     /** 
    74     * Deletes a note forever. 
    75     * @param noteId the id of the note to kill 
    76     * @param force do not request confirmation 
    77     */ 
    78     virtual ASYNC killNote( const QString& noteId, bool force ) = 0; 
     73                /** 
     74                * Deletes a note forever. 
     75                * @param noteId the id of the note to kill 
     76                * @param force do not request confirmation 
     77                */ 
     78                virtual ASYNC killNote( const QString& noteId, bool force ) = 0; 
    7979 
    80     /** 
    81     * Get all the notes including their ids. 
    82     * @return a QMap that maps the id of a note to its name 
    83     */ 
    84     virtual QMap<QString,QString> notes() const = 0; 
     80                /** 
     81                * Get all the notes including their ids. 
     82                * @return a QMap that maps the id of a note to its name 
     83                */ 
     84                virtual QMap<QString,QString> notes() const = 0; 
    8585 
    86     /** 
    87     * Changes the title/name of a note. 
    88     * @param noteId the id of the note to be modified 
    89     * @param newName the new title 
    90     */ 
    91     virtual ASYNC setName( const QString& noteId, const QString& newName ) = 0; 
     86                /** 
     87                * Changes the title/name of a note. 
     88                * @param noteId the id of the note to be modified 
     89                * @param newName the new title 
     90                */ 
     91                virtual ASYNC setName( const QString& noteId, const QString& newName ) = 0; 
    9292 
    93     /** 
    94     * Sets the text of a note. This will delete the old text! 
    95     * @param noteId the id of the note 
    96     * @param newText the new text for the note 
    97     */ 
    98     virtual ASYNC setText( const QString& noteId, const QString& newText ) = 0; 
     93                /** 
     94                * Sets the text of a note. This will delete the old text! 
     95                * @param noteId the id of the note 
     96                * @param newText the new text for the note 
     97                */ 
     98                virtual ASYNC setText( const QString& noteId, const QString& newText ) = 0; 
    9999 
    100     /** 
    101     * Returns the title/name of a note. 
    102     * @param noteId the id of the note in question 
    103     * @return the name as a QString 
    104     */ 
    105     virtual QString name( const QString& noteId ) const = 0; 
     100                /** 
     101                * Returns the title/name of a note. 
     102                * @param noteId the id of the note in question 
     103                * @return the name as a QString 
     104                */ 
     105                virtual QString name( const QString& noteId ) const = 0; 
    106106 
    107     /** 
    108     * Returns the text of a note. 
    109     * @param noteId the id of the note in question 
    110     * @return the body as a QString 
    111     */ 
    112     virtual QString text( const QString& noteId ) const = 0; 
     107                /** 
     108                * Returns the text of a note. 
     109                * @param noteId the id of the note in question 
     110                * @return the body as a QString 
     111                */ 
     112                virtual QString text( const QString& noteId ) const = 0; 
    113113 
    114     /** 
    115     * This tells KNotes that a specific app has synchronized with all the notes. 
    116     * @param app the app that has synced with KNotes 
    117     */ 
    118     virtual ASYNC sync( const QString& app ) = 0; 
     114                /** 
     115                * This tells KNotes that a specific app has synchronized with all the notes. 
     116                * @param app the app that has synced with KNotes 
     117                */ 
     118                virtual ASYNC sync( const QString& app ) = 0; 
    119119 
    120     /** 
    121     * Test if a note was created new after the last sync. 
    122     * @param app the app that wants to get the status since the last sync 
    123     * @param noteId the id of the note 
    124     * @return true if the note is new, false if not or if the note does 
    125     *         not exist 
    126     */ 
    127     virtual bool isNew( const QString& app, const QString& noteId ) const = 0; 
     120                /** 
     121                * Test if a note was created new after the last sync. 
     122                * @param app the app that wants to get the status since the last sync 
     123                * @param noteId the id of the note 
     124                * @return true if the note is new, false if not or if the note does 
     125                *         not exist 
     126                */ 
     127                virtual bool isNew( const QString& app, const QString& noteId ) const = 0; 
    128128 
    129     /** 
    130     * Test if a note was modified since the last sync. 
    131     * @param app the app that wants to get the status since the last sync 
    132     * @param noteId the id of the note 
    133     * @return true if modified (note that this will return true if the note is 
    134     *         new as well!) and false if the note is not modified or doesn't exist 
    135     */ 
    136     virtual bool isModified( const QString& app, const QString& noteId ) const = 0; 
     129                /** 
     130                * Test if a note was modified since the last sync. 
     131                * @param app the app that wants to get the status since the last sync 
     132                * @param noteId the id of the note 
     133                * @return true if modified (note that this will return true if the note is 
     134                *         new as well!) and false if the note is not modified or doesn't exist 
     135                */ 
     136                virtual bool isModified( const QString& app, const QString& noteId ) const = 0; 
    137137}; 
    138138 
  • plugins/kdepim/src/kaddrbook.cpp

    r1617 r1620  
    1 /***********************************************************************  
     1/*********************************************************************** 
    22KAddressbook support for OpenSync kdepim-sync plugin 
    33Copyright (C) 2004 Conectiva S. A. 
    44Copyright (C) 2005 Armin Bauer 
    5  
     5  
    66This program is free software; you can redistribute it and/or modify 
    77it under the terms of the GNU General Public License version 2 as 
    88published by the Free Software Foundation; 
    9  
     9  
    1010THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
    1111OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     
    1616ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF  
    1717OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
    18  
     18  
    1919ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,  
    2020COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS  
     
    3131#include <qdeepcopy.h> 
    3232 
    33 KContactDataSource::KContactDataSource(OSyncMember *member, OSyncHashTable *hashtable)  
    34     : hashtable(hashtable), member(member) 
     33KContactDataSource::KContactDataSource(OSyncMember *member, OSyncHashTable *hashtable) : hashtable(hashtable), member(member) 
    3534{ 
    3635        connected = false; 
     
    4443QString KContactDataSource::calc_hash(KABC::Addressee &e) 
    4544{ 
    46     //Get the revision date of the KDE addressbook entry. 
    47     //Regard entries with invalid revision dates as having just been changed. 
    48     QDateTime revdate = e.revision(); 
    49     osync_debug("kde", 3, "Getting hash: %s", revdate.toString().data()); 
    50     if (!revdate.isValid()) 
    51     { 
    52         revdate = QDateTime::currentDateTime(); 
    53         e.setRevision(revdate); 
    54     } 
    55  
    56     return revdate.toString(); 
     45        //Get the revision date of the KDE addressbook entry. 
     46        //Regard entries with invalid revision dates as having just been changed. 
     47        QDateTime revdate = e.revision(); 
     48        osync_debug("kde", 3, "Getting hash: %s", revdate.toString().data()); 
     49        if (!revdate.isValid()) { 
     50                revdate = QDateTime::currentDateTime(); 
     51                e.setRevision(revdate); 
     52        } 
     53 
     54        return revdate.toString(); 
    5755} 
    5856 
     
    6058{ 
    6159        osync_trace(TRACE_ENTRY, "%s(%p)", __func__, ctx); 
    62          
     60 
    6361        DCOPClient *dcopc = KApplication::kApplication()->dcopClient(); 
    6462        if (!dcopc) { 
     
    8078        //get a handle to the standard KDE addressbook 
    8179        addressbookptr = KABC::StdAddressBook::self(); 
    82          
     80 
    8381        //Detection mechanismn if this is the first sync 
    8482        if (!osync_anchor_compare(member, "synced", "true")) { 
     
    119117{ 
    120118        osync_trace(TRACE_ENTRY, "%s(%p)", __func__, ctx); 
    121          
     119 
    122120        if (osync_member_get_slow_sync(member, "contact")) { 
    123121                osync_trace(TRACE_INTERNAL, "Got slow-sync"); 
    124122                osync_hashtable_set_slow_sync(hashtable, "contact"); 
    125123        } 
    126          
     124 
    127125        // We must reload the KDE addressbook in order to retrieve the latest changes. 
    128126        if (!addressbookptr->load()) { 
     
    135133        for (KABC::AddressBook::Iterator it=addressbookptr->begin(); it!=addressbookptr->end(); it++ ) { 
    136134                QString uid = it->uid(); 
    137                  
     135 
    138136                OSyncChange *chg = osync_change_new(); 
    139                  
     137 
    140138                osync_change_set_member(chg, member); 
    141139                osync_change_set_uid(chg, uid.local8Bit()); 
    142                  
     140 
    143141                QString hash = calc_hash(*it); 
    144                          
     142 
    145143                // Convert the VCARD data into a string 
    146144                // only vcard3.0 exports Categories 
     
    150148 
    151149                osync_trace(TRACE_SENSITIVE,"\n%s", data); 
    152                  
     150 
    153151                osync_change_set_data(chg, data, strlen(data) + 1, TRUE); 
    154                  
     152 
    155153                // object type and format 
    156154                osync_change_set_objtype_string(chg, "contact"); 
    157155                osync_change_set_objformat_string(chg, "vcard30"); 
    158                  
     156 
    159157                // Use the hash table to check if the object 
    160158                // needs to be reported 
     
    165163                } 
    166164        } 
    167          
     165 
    168166        // Use the hashtable to report deletions 
    169167        osync_hashtable_report_deleted(hashtable, ctx, "contact"); 
    170168 
    171     osync_trace(TRACE_EXIT, "%s", __func__); 
     169        osync_trace(TRACE_EXIT, "%s", __func__); 
    172170        return true; 
    173171} 
     
    184182        osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, ctx, chg); 
    185183        KABC::VCardConverter converter; 
    186          
     184 
    187185        // convert VCARD string from obj->comp into an Addresse object. 
    188186        char *data = osync_change_get_data(chg); 
    189187        size_t data_size = osync_change_get_datasize(chg); 
    190188        QString uid = osync_change_get_uid(chg); 
    191          
     189 
    192190        OSyncChangeType chtype = osync_change_get_changetype(chg); 
    193191        switch(chtype) { 
    194192                case CHANGE_MODIFIED: { 
    195193                        KABC::Addressee addressee = converter.parseVCard(QString::fromUtf8(data, data_size)); 
    196                          
     194 
    197195                        // ensure it has the correct UID and revision 
    198196                        addressee.setUid(uid); 
    199197                        addressee.setRevision(QDateTime::currentDateTime()); 
    200                          
     198 
    201199                        // replace the current addressbook entry (if any) with the new one 
    202                          
     200 
    203201                        addressbookptr->insertAddressee(addressee); 
    204                          
     202 
    205203                        QString hash = calc_hash(addressee); 
    206204                        osync_change_set_hash(chg, hash); 
    207                         osync_debug("kde", 3, "KDE ADDRESSBOOK ENTRY UPDATED (UID=%s)", (const char *)uid.local8Bit());  
     205                        osync_debug("kde", 3, "KDE ADDRESSBOOK ENTRY UPDATED (UID=%s)", (const char *)uid.local8Bit()); 
    208206                        break; 
    209207                } 
    210208                case CHANGE_ADDED: { 
    211209                        KABC::Addressee addressee = converter.parseVCard(QString::fromUtf8(data, data_size)); 
    212                          
     210 
    213211                        // ensure it has the correct revision 
    214212                        addressee.setRevision(QDateTime::currentDateTime()); 
    215                          
     213 
    216214                        // add the new address to the addressbook 
    217215                        addressbookptr->insertAddressee(addressee); 
    218                          
     216 
    219217                        osync_change_set_uid(chg, addressee.uid().local8Bit()); 
    220                          
     218 
    221219                        QString hash = calc_hash(addressee); 
    222220                        osync_change_set_hash(chg, hash); 
     
    230228                                return FALSE; 
    231229                        } 
    232                          
     230 
    233231                        //find addressbook entry with matching UID and delete it 
    234232                        KABC::Addressee addressee = addressbookptr->findByUid(uid); 
    235233                        if(!addressee.isEmpty()) 
    236234                                addressbookptr->removeAddressee(addressee); 
    237                          
     235 
    238236                        osync_debug("kde", 3, "KDE ADDRESSBOOK ENTRY DELETED (UID=%s)", (const char*)uid.local8Bit()); 
    239                          
     237 
    240238                        break; 
    241239                } 
    242                 default: 
     240                default: { 
    243241                        osync_context_report_error(ctx, OSYNC_ERROR_NOT_SUPPORTED, "Operation not supported"); 
    244242                        osync_trace(TRACE_EXIT_ERROR, "%s: Operation not supported", __func__); 
    245243                        return FALSE; 
    246         } 
    247          
     244                } 
     245        } 
     246 
    248247        osync_trace(TRACE_EXIT, "%s", __func__); 
    249248        return TRUE; 
     
    261260bool KContactDataSource::vcard_commit_change(OSyncContext *ctx, OSyncChange *chg) 
    262261{ 
    263     if ( !__vcard_access(ctx, chg) ) 
    264         return false; 
    265  
    266     osync_hashtable_update_hash(hashtable, chg); 
    267     osync_context_report_success(ctx); 
    268     return true; 
    269 } 
     262        if ( !__vcard_access(ctx, chg) ) 
     263                return false; 
     264 
     265        osync_hashtable_update_hash(hashtable, chg); 
     266        osync_context_report_success(ctx); 
     267        return true; 
     268} 
  • plugins/kdepim/src/kaddrbook.h

    r672 r1620  
    1 /***********************************************************************  
     1/*********************************************************************** 
    22MultiSync Plugin for KDE 3.x 
    33Copyright (C) 2004 Stewart Heitmann <sheitmann@users.sourceforge.net> 
    4  
     4  
    55This program is free software; you can redistribute it and/or modify 
    66it under the terms of the GNU General Public License version 2 as 
    77published by the Free Software Foundation; 
    8  
     8  
    99THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
    1010OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     
    1515ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF  
    1616OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
    17  
     17  
    1818ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,  
    1919COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS  
     
    3030#include "osyncbase.h" 
    3131 
    32 class KContactDataSource { 
    33     private: 
     32class KContactDataSource 
     33{ 
     34        private: 
    3435                KABC::AddressBook* addressbookptr; 
    3536 
    36         OSyncHashTable *hashtable; 
    37         OSyncMember *member; 
     37                OSyncHashTable *hashtable; 
     38                OSyncMember *member; 
    3839 
    39         bool __vcard_access(OSyncContext *ctx, OSyncChange *chg); 
     40                bool __vcard_access(OSyncContext *ctx, OSyncChange *chg); 
    4041 
    41     public: 
    42         KContactDataSource(OSyncMember *member, OSyncHashTable *hashtable); 
     42        public: 
     43                KContactDataSource(OSyncMember *member, OSyncHashTable *hashtable); 
    4344 
    4445                QString calc_hash(KABC::Addressee &e); 
    45         bool connect(OSyncContext *ctx); 
    46         bool disconnect(OSyncContext *ctx); 
    47         bool contact_get_changeinfo(OSyncContext *ctx); 
    48         bool vcard_access(OSyncContext *ctx, OSyncChange *chg); 
    49         bool vcard_commit_change(OSyncContext *ctx, OSyncChange *chg); 
     46                bool connect(OSyncContext *ctx); 
     47                bool disconnect(OSyncContext *ctx); 
     48                bool contact_get_changeinfo(OSyncContext *ctx); 
     49                bool vcard_access(OSyncContext *ctx, OSyncChange *chg); 
     50                bool vcard_commit_change(OSyncContext *ctx, OSyncChange *chg); 
    5051                bool connected; 
    5152}; 
  • plugins/kdepim/src/kcal.cpp

    r1617 r1620  
    1 /***********************************************************************  
     1/*********************************************************************** 
    22KCalendar support for OpenSync kdepim-sync plugin 
    33Copyright (C) 2004 Conectiva S. A. 
    4  
     4  
    55This program is free software; you can redistribute it and/or modify 
    66it under the terms of the GNU General Public License version 2 as 
    77published by the Free Software Foundation; 
    8  
     8  
    99THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
    1010OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
     
    1515ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF  
    1616OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
    17  
     17  
    1818ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,  
    1919COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS  
     
    3030 
    3131KCalDataSource::KCalDataSource(OSyncMember *member, OSyncHashTable *hashtable) 
    32     : hashtable(hashtable), member(member) 
     32                : hashtable(hashtable), member(member) 
    3333{ 
    3434        connected = false; 
     
    5555        } 
    5656 
    57     calendar = new KCal::CalendarResources(QString::fromLatin1( "UTC" )); 
    58     if (!calendar) { 
    59         osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, "Can't open KDE calendar"); 
    60         return false; 
    61     } 
     57        calendar = new KCal::CalendarResources(QString::fromLatin1( "UTC" )); 
     58        if (!calendar) { 
     59                osync_context_report_error(ctx, OSYNC_ERROR_GENERIC, "Can't open KDE calendar"); 
     60                return false; 
     61        } 
    6262#if KDE_IS_VERSION(3,3,0) 
    63     /* On KDE 3.2, there was no readConfig() and load(): the data 
    64     * was loaded automatically on the CalendarResources() constructor 
    65     */ 
    66     calendar->readConfig(); 
    67     calendar->load(); 
     63        /* On KDE 3.2, there was no readConfig() and load(): the data 
     64        * was loaded automatically on the CalendarResources() constructor 
     65        */ 
     66        calendar->readConfig(); 
     67        calendar->load(); 
    6868#endif 
    69     osync_debug("kcal", 3, "Calendar: %d events", calendar->events().size()); 
    70      
     69        osync_debug("kcal", 3, "Calendar: %d events", calendar->events().size()); 
     70 
    7171        connected = true; 
    7272        return true; 
     
    7575bool KCalDataSource::disconnect(OSyncContext *) 
    7676{ 
    77          
    78     </