//qDBusRegisterMetaType<org::maemo::vicar::Profile>();
//qDBusRegisterMetaType<org::maemo::vicar::ProfileList>();
- TelepathyUtility *tpUtility = new TelepathyUtility();
- DatabaseUtility *databaseUtility = new DatabaseUtility();
- HarmattanAccountUtility *accountUtility = new HarmattanAccountUtility();
+ TelepathyUtility tpUtility;
+ DatabaseUtility databaseUtility;
if (argc > 1 && argv[1]){
QString instruction = QString(argv[1]);
if (instruction == "INSTALL"){
//Check if Account already exists
- if (!tpUtility->accountExists()){
+ if (!tpUtility.accountExists()){
qDebug() << "VICaR account not found. Creating ..";
- bool result = tpUtility->createAccount();
+ bool result = tpUtility.createAccount();
if (!result) exit(1);
}
else{
}
}
else if (instruction == "REMOVE"){
- bool result = tpUtility->deleteAccount();
+ bool result = tpUtility.deleteAccount();
if (!result) exit(2);
}
else if (instruction == "TESTING"){
- tpUtility->callNumberWithRing(argv[2]);
+ tpUtility.callNumberWithRing(argv[2]);
}
else if (instruction == "TPACCOUNTSTATUS"){
- QString status = tpUtility->getAccountStatus();
+ QString status = tpUtility.getAccountStatus();
qDebug() << "Account Status is "<< status;
}
#if defined(Q_WS_MAEMO_5)
else if (instruction == "CREATEDB"){
- bool result = databaseUtility->openDatabase();
+ bool result = databaseUtility.openDatabase();
if (!result){
qDebug() <<"Error creating vicar database. "
- <<databaseUtility->lastError();
+ <<databaseUtility.lastError();
exit(3);
}
qDebug() << "VICaR database opened.";
qDebug() << "Preparing VICaR tables..";
- result = databaseUtility->prepareTables();
+ result = databaseUtility.prepareTables();
if (!result){
qDebug() <<"Error creating tables. "
- <<databaseUtility->lastError();
+ <<databaseUtility.lastError();
exit(4);
}
- databaseUtility->closeDatabase();
+ databaseUtility.closeDatabase();
}
else if (instruction == "DROPDB"){
- bool result = databaseUtility->deleteDatabase();
+ bool result = databaseUtility.deleteDatabase();
if (!result){
qDebug() <<"Error deleting vicar database. "
- <<databaseUtility->lastError();
+ <<databaseUtility.lastError();
exit(5);
}
qDebug() << "VICaR database deleted.";
#elif defined(Q_WS_MAEMO_6)
else if (instruction == "--create-account"){
qDebug() << "Creating account";
- accountUtility->addAccount();
+ HarmattanAccountUtility accountUtility;
+ accountUtility.addAccount();
}
else if (instruction == "--delete-account"){
qDebug() << "Deleting account";
- accountUtility->removeAccount();
+ HarmattanAccountUtility accountUtility;
+ accountUtility.removeAccount();
}
#endif
else {
qDebug() << QCryptographicHash::hash("VICaR",QCryptographicHash::Md5).toHex();
}
- delete (tpUtility);
- delete (databaseUtility);
- delete (accountUtility);
- tpUtility = 0;
- databaseUtility = 0;
- accountUtility = 0;
}