3 @author: Sudheer K. <scifi1947 at gmail.com>
4 @license: GNU General Public License
7 #include "telepathyutility.h"
8 #include "databaseutility.h"
9 #include "vicarprofiletypes.h"
10 #include "connectioninterfacerequeststypes.h"
12 #include <QDBusMetaType>
14 int main(int argc, char *argv[])
16 qDBusRegisterMetaType<org::freedesktop::Telepathy::SimplePresence>();
17 //From Connection Interface Requests
18 qDBusRegisterMetaType<org::freedesktop::Telepathy::ChannelDetails>();
19 qDBusRegisterMetaType<org::freedesktop::Telepathy::ChannelDetailsList>();
20 qDBusRegisterMetaType<org::freedesktop::Telepathy::RequestableChannelClass>();
21 qDBusRegisterMetaType<org::freedesktop::Telepathy::RequestableChannelClassList>();
22 //From Vicar Profile Types
23 //qDBusRegisterMetaType<org::maemo::vicar::Profile>();
24 //qDBusRegisterMetaType<org::maemo::vicar::ProfileList>();
26 TelepathyUtility *tpUtility = new TelepathyUtility();
27 DatabaseUtility *databaseUtility = new DatabaseUtility();
29 if (argc > 1 && argv[1]){
30 QString instruction = QString(argv[1]);
31 if (instruction == "INSTALL"){
32 //Check if Account already exists
33 if (!tpUtility->accountExists()){
34 qDebug() << "VICaR account not found. Creating ..";
35 bool result = tpUtility->createAccount();
39 qDebug() << "VICaR account found.";
42 else if (instruction == "REMOVE"){
43 bool result = tpUtility->deleteAccount();
47 else if (instruction == "CREATEDB"){
48 bool result = databaseUtility->openDatabase();
50 qDebug() <<"Error creating profiles database. "
51 <<databaseUtility->lastError();
54 qDebug() << "VICaR profiles database opened.";
56 if (!databaseUtility->tableExists("profiles")){
57 qDebug() << "Creating VICaR profiles table..";
58 result = databaseUtility->createProfilesTable();
60 qDebug() <<"Error creating profiles table. "
61 <<databaseUtility->lastError();
66 qDebug()<<"Profiles table exists";
68 databaseUtility->closeDatabase();
70 else if (instruction == "DROPDB"){
71 bool result = databaseUtility->deleteDatabase();
73 qDebug() <<"Error deleting profiles database. "
74 <<databaseUtility->lastError();
77 qDebug() << "VICaR profiles database deleted.";
79 else if (instruction == "ACCOUNTSTATUS"){
80 QString status = tpUtility->getAccountStatus();
81 qDebug() << "Account Status is "<< status;
83 else if (instruction == "TESTING"){
84 tpUtility->callNumberWithRing(argv[2]);
89 delete (databaseUtility);