kitchensync

profile.cpp

00001 /*
00002     This file is part of KitchenSync.
00003 
00004     Copyright (c) 2002 Holger Freyther <zecke@handhelds.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., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #include <kapplication.h>
00023 
00024 #include "profile.h"
00025 
00026 using namespace KSync;
00027 
00028 Profile::Profile()
00029 {
00030 // generate new uid
00031     m_uid =kapp->randomString( 8 );
00032 }
00033 
00034 Profile::Profile( const Profile& prof )
00035 {
00036     (*this) = prof;
00037 }
00038 
00039 Profile::~Profile()
00040 {
00041 }
00042 
00043 QString Profile::name() const
00044 {
00045     return m_name;
00046 }
00047 
00048 QString Profile::uid() const
00049 {
00050     return m_uid;
00051 }
00052 
00053 QString Profile::pixmap() const
00054 {
00055     return m_pixmap;
00056 }
00057 
00058 bool Profile::confirmDelete() const
00059 {
00060     return m_confirmDelete;
00061 }
00062 
00063 bool Profile::confirmSync() const
00064 {
00065     return m_confirmSync;
00066 }
00067 
00068 void Profile::setName( const QString &name )
00069 {
00070     m_name = name;
00071 }
00072 
00073 void Profile::setPixmap( const QString &pixmap )
00074 {
00075     m_pixmap = pixmap;
00076 }
00077 
00078 void Profile::setUid( const QString &uid )
00079 {
00080     m_uid = uid;
00081 }
00082 
00083 void Profile::setActionParts( const ActionPartService::List &list )
00084 {
00085     m_actionPartServices = list;
00086 }
00087 
00088 ActionPartService::List Profile::actionParts() const
00089 {
00090     return m_actionPartServices;
00091 }
00092 
00093 QMap<QString,QString> Profile::paths() const
00094 {
00095     return m_map;
00096 }
00097 
00098 void Profile::setPaths(const QMap<QString, QString>& map )
00099 {
00100     m_map = map;
00101 }
00102 
00103 void Profile::setPath( const QString& partName,  const QString& path )
00104 {
00105     m_map.replace( partName, path );
00106 }
00107 
00108 void Profile::setConfirmSync( bool b )
00109 {
00110     m_confirmSync = b;
00111 }
00112 
00113 void Profile::setConfirmDelete( bool b )
00114 {
00115     m_confirmDelete = b;
00116 }
00117 
00118 QString Profile::path( const QString &partName ) const
00119 {
00120     QMap<QString, QString>::ConstIterator it;
00121     QString path;
00122     it = m_map.find( partName );
00123     if ( it != m_map.end() )
00124         path = it.data();
00125 
00126     return path;
00127 }
00128 
00129 Profile &Profile::operator=( const Profile &prof )
00130 {
00131     if (&prof == this ) return *this;
00132 
00133     m_name = prof.m_name;
00134     m_uid = prof.m_uid;
00135     m_pixmap = prof.m_pixmap;
00136     m_actionPartServices = prof.m_actionPartServices;
00137     m_map = prof.m_map;
00138     m_confirmSync = prof.m_confirmSync;
00139     m_confirmDelete = prof.m_confirmDelete;
00140     return *this;
00141 }
00142 
00143 bool Profile::operator==( const Profile &prof2 ) {
00144     if ( uid() == prof2.uid() &&
00145          name() == prof2.name() &&
00146          pixmap() == prof2.pixmap() )
00147         return true;
00148     else return false;
00149 
00150 }
00151 
00152 /*bool operator!=( const Profile& prof1, const Profile& prof2 ) {
00153     return !( prof1 == prof2 );
00154 }
00155 */
KDE Home | KDE Accessibility Home | Description of Access Keys