~ubuntu-branches/ubuntu/karmic/choqok/karmic

« back to all changes in this revision

Viewing changes to src/account.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Steve Stalcup
  • Date: 2009-02-11 20:31:26 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090211203126-7uqucqt5r2harpds
Tags: 0.4-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    This file is part of choqoK, the KDE mono-blogging client
 
3
 
 
4
    Copyright (C) 2008-2009 Mehrdad Momeny <mehrdad.momeny@gmail.com>
 
5
 
 
6
    This program is free software; you can redistribute it and/or
 
7
    modify it under the terms of the GNU General Public License as
 
8
    published by the Free Software Foundation; either version 2 of
 
9
    the License or (at your option) version 3 or any later version
 
10
    accepted by the membership of KDE e.V. (or its successor approved
 
11
    by the membership of KDE e.V.), which shall act as a proxy
 
12
    defined in Section 14 of version 3 of the license.
 
13
 
 
14
 
 
15
    This program is distributed in the hope that it will be useful,
 
16
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
18
    GNU General Public License for more details.
 
19
 
 
20
    You should have received a copy of the GNU General Public License
 
21
    along with this program; if not, see http://www.gnu.org/licenses/
 
22
 
 
23
*/
 
24
#include "account.h"
 
25
 
 
26
Account::Account( Service type )
 
27
{
 
28
    setServiceType(type);
 
29
}
 
30
 
 
31
Account::Account( )
 
32
{
 
33
}
 
34
 
 
35
Account::~Account()
 
36
{
 
37
}
 
38
 
 
39
Account::Account( const Account & account )
 
40
{
 
41
    mUserId = account.userId();
 
42
    mUsername = account.username();
 
43
    mPassword = account.password();
 
44
    mServiceName = account.serviceName();
 
45
    mAlias = account.alias();
 
46
    mDirection = account.direction();
 
47
    mApiPath = account.apiPath();
 
48
    mIsError = account.isError();
 
49
    mServiceType = account.serviceType();
 
50
}
 
51
 
 
52
uint Account::userId() const
 
53
{
 
54
    return mUserId;
 
55
}
 
56
 
 
57
void Account::setUserId( uint id )
 
58
{
 
59
    mUserId = id;
 
60
}
 
61
 
 
62
QString Account::username() const
 
63
{
 
64
    return mUsername;
 
65
}
 
66
 
 
67
void Account::setUsername( const QString & name )
 
68
{
 
69
    mUsername = name;
 
70
}
 
71
 
 
72
QString Account::password() const
 
73
{
 
74
    return mPassword;
 
75
}
 
76
 
 
77
void Account::setPassword( const QString & pass )
 
78
{
 
79
    mPassword = pass;
 
80
}
 
81
 
 
82
QString Account::serviceName() const
 
83
{
 
84
    return mServiceName;
 
85
}
 
86
 
 
87
// void Account::setServiceName( const QString & servicename )
 
88
// {
 
89
//     mServiceName = servicename;
 
90
// }
 
91
 
 
92
QString Account::alias() const
 
93
{
 
94
    return mAlias;
 
95
}
 
96
 
 
97
void Account::setAlias( const QString & alias )
 
98
{
 
99
    mAlias = alias;
 
100
}
 
101
 
 
102
Qt::LayoutDirection Account::direction() const
 
103
{
 
104
    return mDirection;
 
105
}
 
106
 
 
107
void Account::setDirection( const Qt::LayoutDirection & dir )
 
108
{
 
109
    mDirection = dir;
 
110
}
 
111
 
 
112
QString Account::apiPath() const
 
113
{
 
114
    return mApiPath;
 
115
}
 
116
 
 
117
// void Account::setApiPath( const QString & apiPath )
 
118
// {
 
119
//     mApiPath = apiPath;
 
120
// }
 
121
 
 
122
void Account::setError( bool isError )
 
123
{
 
124
    mIsError = isError;
 
125
}
 
126
 
 
127
bool Account::isError() const
 
128
{
 
129
    return mIsError;
 
130
}
 
131
 
 
132
Account::Service Account::serviceType() const
 
133
{
 
134
    return mServiceType;
 
135
}
 
136
 
 
137
void Account::setServiceType( Service type )
 
138
{
 
139
    mServiceType = type;
 
140
    if ( type == Identica){
 
141
        mServiceName = "Identi.ca";
 
142
        mApiPath = "http://identi.ca/api/";
 
143
    } else if (type == Twitter) {
 
144
        mServiceName = "Twitter.com";
 
145
        mApiPath = "http://twitter.com/";
 
146
    }
 
147
}