00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
#include "profilemanager.h"
00023
00024
using namespace KSync;
00025
00026 ProfileManager::ProfileManager()
00027 {
00028 }
00029
00030 ProfileManager::ProfileManager(
const Profile::List &list )
00031 : mProfiles( list )
00032 {
00033 }
00034
00035 ProfileManager::~ProfileManager()
00036 {
00037 }
00038
00039 Profile ProfileManager::currentProfile()
const
00040
{
00041
return mCurrentProfile;
00042 }
00043
00044 void ProfileManager::setCurrentProfile(
const Profile &prof )
00045 {
00046 mCurrentProfile = prof;
00047 }
00048
00049 Profile::List ProfileManager::profiles()
const
00050
{
00051
return mProfiles;
00052 }
00053
00054 void ProfileManager::setProfiles(
const Profile::List &list )
00055 {
00056 mProfiles = list;
00057 mCurrentProfile =
Profile();
00058 }
00059
00060 Profile ProfileManager::byName(
const QString &name )
00061 {
00062
Profile prof;
00063
00064 Profile::List::Iterator it;
00065
for ( it = mProfiles.begin(); it != mProfiles.end(); ++it ) {
00066
if ( (*it).name() == name ) {
00067 prof = (*it);
00068
break;
00069 }
00070 }
00071
return prof;
00072 }
00073
00074 Profile::List ProfileManager::byName2(
const QString& name )
00075 {
00076
Profile::List list;
00077 Profile::List::Iterator it;
00078
for ( it = mProfiles.begin(); it != mProfiles.end(); ++it ) {
00079
if ( (*it).name() == name )
00080 list.append( (*it) );
00081 }
00082
return list;
00083 }
00084
00085
00086
00087
00088
00089
00090
00091 void ProfileManager::load()
00092 {
00093 mProfiles = mProfileConfig.load();
00094 }
00095
00096 void ProfileManager::save()
00097 {
00098 mProfileConfig.save( mProfiles );
00099 }
00100
00101 void ProfileManager::addProfile(
const Profile &prof )
00102 {
00103 mProfiles.append( prof );
00104 }
00105
00106 void ProfileManager::replaceProfile(
const Profile &prod )
00107 {
00108 mProfiles.remove( prod );
00109 mProfiles.append( prod );
00110 }
00111
00112 void ProfileManager::removeProfile(
const Profile &prof )
00113 {
00114 mProfiles.remove( prof );
00115 }
00116
00117
Profile ProfileManager::profile(
int i )
const
00118
{
00119
return mProfiles[i];
00120 }
00121
00122 int ProfileManager::count()
const
00123
{
00124
return mProfiles.count();
00125 }