Release 0.5-1 contains (Muti-profile support, Contacts Integration)
authorsudheer <sudheer@sudheer-ubuntu-lucid.(none)>
Fri, 10 Sep 2010 16:19:55 +0000 (09:19 -0700)
committersudheer <sudheer@sudheer-ubuntu-lucid.(none)>
Fri, 10 Sep 2010 16:19:55 +0000 (09:19 -0700)
95 files changed:
debian/changelog [changed mode: 0644->0755]
debian/compat [changed mode: 0644->0755]
debian/control [changed mode: 0644->0755]
debian/copyright [changed mode: 0644->0755]
debian/dirs [changed mode: 0644->0755]
debian/docs [changed mode: 0644->0755]
debian/files
debian/postinst [changed mode: 0644->0755]
debian/postrm [changed mode: 0644->0755]
debian/prerm [new file with mode: 0644]
debian/rules
debian/vicar.substvars
src/data/icons/26x26/vicar_phone.png [new file with mode: 0755]
src/data/icons/32x32/vicar_phone.png [new file with mode: 0755]
src/data/icons/48x48/vicar_phone.png [new file with mode: 0755]
src/data/icons/64x64/vicar_phone.png [new file with mode: 0755]
src/data/icons/Icon Source.txt [new file with mode: 0644]
src/data/icons/vicar-application.png.base64 [new file with mode: 0644]
src/data/icons/vicar_application.png [new file with mode: 0755]
src/data/icons/vicar_scalable_icon.png [new file with mode: 0755]
src/data/org.freedesktop.Telepathy.ConnectionManager.vicar.service [new file with mode: 0644]
src/data/org.maemo.vicar.service [changed mode: 0644->0755]
src/data/vicar-config.desktop [changed mode: 0644->0755]
src/data/vicar.manager [new file with mode: 0644]
src/data/vicar.profile [new file with mode: 0644]
src/data/xml/connectioninterfacerequestsadaptor.cpp [new file with mode: 0644]
src/data/xml/connectioninterfacerequestsadaptor.h [new file with mode: 0644]
src/data/xml/org.freedesktop.Telepathy.Account.xml [new file with mode: 0644]
src/data/xml/org.freedesktop.Telepathy.AccountManager.xml [new file with mode: 0644]
src/data/xml/org.freedesktop.Telepathy.Connection.I.Requests.xml [new file with mode: 0644]
src/data/xml/org.freedesktop.Telepathy.Connection.xml [new file with mode: 0644]
src/data/xml/org.maemo.vicar.xml [new file with mode: 0755]
src/src.pro [changed mode: 0644->0755]
src/vicar-config/src/main.cpp [changed mode: 0644->0755]
src/vicar-config/src/profilesettingsdialog.cpp [new file with mode: 0644]
src/vicar-config/src/profilesettingsdialog.h [new file with mode: 0644]
src/vicar-config/src/profileswindow.cpp [new file with mode: 0644]
src/vicar-config/src/profileswindow.h [new file with mode: 0644]
src/vicar-config/uis/profilesettingsdialog.ui [new file with mode: 0644]
src/vicar-config/uis/profileswindow.ui [new file with mode: 0644]
src/vicar-config/uis/ui_profilesettingsdialog.h [new file with mode: 0644]
src/vicar-config/uis/ui_profileswindow.h [new file with mode: 0644]
src/vicar-config/vicar-config.pro [changed mode: 0644->0755]
src/vicar-daemon/src/callrouter.cpp [changed mode: 0644->0755]
src/vicar-daemon/src/callrouter.h [changed mode: 0644->0755]
src/vicar-daemon/src/main.cpp [changed mode: 0644->0755]
src/vicar-daemon/src/vicardbusadaptor.cpp [new file with mode: 0755]
src/vicar-daemon/src/vicardbusadaptor.h [new file with mode: 0755]
src/vicar-daemon/vicar-daemon.pro [changed mode: 0644->0755]
src/vicar-lib/src/accountcompatproxy.cpp [new file with mode: 0644]
src/vicar-lib/src/accountcompatproxy.h [new file with mode: 0644]
src/vicar-lib/src/accountmanagerproxy.cpp [new file with mode: 0644]
src/vicar-lib/src/accountmanagerproxy.h [new file with mode: 0644]
src/vicar-lib/src/accountproxy.cpp [new file with mode: 0644]
src/vicar-lib/src/accountproxy.h [new file with mode: 0644]
src/vicar-lib/src/databaseutility.cpp [new file with mode: 0644]
src/vicar-lib/src/databaseutility.h [new file with mode: 0644]
src/vicar-lib/src/dbusutility.cpp [changed mode: 0644->0755]
src/vicar-lib/src/dbusutility.h [changed mode: 0644->0755]
src/vicar-lib/src/gconfutility.cpp [changed mode: 0644->0755]
src/vicar-lib/src/gconfutility.h [changed mode: 0644->0755]
src/vicar-lib/src/telepathyutility.cpp [new file with mode: 0644]
src/vicar-lib/src/telepathyutility.h [new file with mode: 0644]
src/vicar-lib/src/vicarprofiletypes.h [new file with mode: 0644]
src/vicar-lib/vicar-lib.pro [changed mode: 0644->0755]
src/vicar-telepathy/src/basetypes.h [new file with mode: 0644]
src/vicar-telepathy/src/connection.cpp [new file with mode: 0644]
src/vicar-telepathy/src/connection.h [new file with mode: 0644]
src/vicar-telepathy/src/connectionadaptor.cpp [new file with mode: 0644]
src/vicar-telepathy/src/connectionadaptor.h [new file with mode: 0644]
src/vicar-telepathy/src/connectioninterfacecapabilitiesadaptor.cpp [new file with mode: 0644]
src/vicar-telepathy/src/connectioninterfacecapabilitiesadaptor.h [new file with mode: 0644]
src/vicar-telepathy/src/connectioninterfacecapabilitiestypes.cpp [new file with mode: 0644]
src/vicar-telepathy/src/connectioninterfacecapabilitiestypes.h [new file with mode: 0644]
src/vicar-telepathy/src/connectioninterfacerequestsadaptor.cpp [new file with mode: 0644]
src/vicar-telepathy/src/connectioninterfacerequestsadaptor.h [new file with mode: 0644]
src/vicar-telepathy/src/connectioninterfacerequeststypes.cpp [new file with mode: 0644]
src/vicar-telepathy/src/connectioninterfacerequeststypes.h [new file with mode: 0644]
src/vicar-telepathy/src/connectionmanager.cpp [new file with mode: 0644]
src/vicar-telepathy/src/connectionmanager.h [new file with mode: 0644]
src/vicar-telepathy/src/connectionmanageradaptor.cpp [new file with mode: 0644]
src/vicar-telepathy/src/connectionmanageradaptor.h [new file with mode: 0644]
src/vicar-telepathy/src/connectionmanagertypes.cpp [new file with mode: 0644]
src/vicar-telepathy/src/connectionmanagertypes.h [new file with mode: 0644]
src/vicar-telepathy/src/connectiontypes.cpp [new file with mode: 0644]
src/vicar-telepathy/src/connectiontypes.h [new file with mode: 0644]
src/vicar-telepathy/src/main.cpp [new file with mode: 0644]
src/vicar-telepathy/src/names.h [new file with mode: 0644]
src/vicar-telepathy/src/vicarcallrouterproxy.cpp [new file with mode: 0644]
src/vicar-telepathy/src/vicarcallrouterproxy.h [new file with mode: 0644]
src/vicar-telepathy/vicar-telepathy.pro [new file with mode: 0644]
src/vicar-utils/src/main.cpp [new file with mode: 0755]
src/vicar-utils/vicar-utils.pro [new file with mode: 0755]
vicar.pro [changed mode: 0644->0755]
welcome [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 2d320ad..23aeca2
@@ -1,12 +1,6 @@
-vicar (0.2-1) unstable; urgency=low
+vicar (0.5-1) unstable; urgency=low
 
-  * Fixed a bug that does not allow Country Codes to Exclude to be blank
-  * Save button now displays a success notification
-  * Settings will be automatically saved on close
-  * Save and Reset buttons moved to Hildon application menu
-  * Calling Card Number and Country Codes to Exclude fields accept numbers by default for hardware keyboard
-  * Merged basic and advanced settings into one screen
-  * Code cleanup
+  * Fixed Dbus activation error.
 
- -- Sudheer K. <scifi.guy@hotmail.com>  Sat,  8 May 2010 13:57:08 -0700
+ -- Sudheer K. <scifi1947 at gmail.com>  Fri,  03 Sep 2010 08:10:00 +0530
 
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index 3b47fc0..0200b85
@@ -1,7 +1,7 @@
 Source: vicar
 Section: user/network
 Priority: extra
-Maintainer: Sudheer K. <scifi.guy@hotmail.com>
+Maintainer: Sudheer K. <scifi1947 at gmail.com>
 Build-Depends: debhelper (>= 5), libqt4-dev, libgconf2-dev
 Standards-Version: 3.7.2
 Homepage: vicar.garage.maemo.org
@@ -11,7 +11,70 @@ XB-Maemo-Display-Name: VICaR - Value International Call Router
 Package: vicar
 Architecture: any
 Depends: ${shlibs:Depends}
-Description: Automatically routes international GSM calls through a calling card number.
+Description: Automatically routes international GSM calls through a calling card or skype-out number.
  * Calling card number and other options can be configured by launching VICaR from applications menu.
  * Make sure to update all your international numbers to start with the appropriate dialing code and a prefix of + or 00.
  * To avoid routing local calls through VICaR, add the local country codes to the list of country codes to exclude.
+XB-Maemo-Icon-26:
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c
+ 6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0
+ SU1FB9oIAwM2Kg1VlzwAAApHSURBVGje7VhtbBxX2T3PvfM9s971bhon7iaO
+ k7ROrLgpiS3SgigNRUWq3legKEitGkpBohGQIISIUPiDUFWVikJlVQj4QdUK
+ FCGIUsTbvqIFRwltCaqw7LbIdWIlthOc9W52vVnv7szOzL2XH+ysnAJtWsof
+ 8JEezezM3J1z7j17n+dZYBWrWMUqVrGKVazivxf0fn/hwYMHTSGEqWmaJqXk
+ UkqmlCKlFGzbhq7rsaZpcRRFwrIs/9FHH41Xjn/sscdw5MiRf5+Affv24fjx
+ 49dcO3DgwMY4jm/RNO0DSqkhxlgf5zwDoAuABcBQSild1yUR1TjnS1LKq0R0
+ jjF2njE2qWnan5544om//NtW4PDhwxgbG8Mbb7wBANi7d+9HOOcHAHw4juMs
+ gBQR2UopKKXAGIOmaZ3gnIOIoGkaGGOQUgIANE1DHMc+gCYRXTJN82ddXV0/
+ efLJJ8v79u2DEALPPvvsvyagu7sbS0tL2L17t+t53ueFEF/3fT+/vLyMRqOB
+ MAwhpYSUEpxzZZomXblyBYwxEBGUUiAiMMbAGAMAeJ6nlFJERCAimKapPM+j
+ XC6HVCoFTdN+6HnekWeeeWb57bjx6xEQBAEA5DzP+1V/f//BfD7flU6nIaVU
+ pVKJ6vX6m4yxX99www1OPp9f43keHMeBrutIp9Po7e2F67qwbRs333wzLMvC
+ tm3baN26dbJYLH6/UqncEARBLp1Oq82bN6O3t5c458O1Wu0u0zR/WygUqv+y
+ hWzbPrJ169bv3HLLLcp1XTDGKIoiXLhwAWfPnt12++23XxJCPAVgfyqVwubN
+ mxGGIbZs2YK5uTls374dMzMzKBQKsCwLs7Oz4Jyjt7d3w+jo6NYNGzac3L17
+ N3K5HBzHUZqmoVar0czMzI/m5ua+PDMzE/8jXuztSDuO87eHGOsFsD8IAhQK
+ BapUKtRsNhGGoVpcXITv+19JpVKqu7s729PTgyiKsLy8jCiKUK1WMT8/j1df
+ fRVxHGNoaAitVgs33XQT1q5dC6XU5jiO3xRCoFarYXl5GeVymYrFIlWrVVSr
+ 1fuWl5fXvScLRVEEIrqZiH5BRMNCiI7Xfd+HlJIsy1Lnz58fOX/+fPfIyMh2
+ znnPrl27kEqlUC6XkcvlMDw8jPXr12NpaQmFQgH5fB5xHMMwDGiaVn7ppZeK
+ YRh+zrIscM4RBAGazSauXr2qLl++bDYajekgCP70jzhq72QdXde/adv2sO/7
+ aDabanFxkWq1GjKZDHp6elSlUiEpJVzXvRtA/549e+D7PiYnJzEyMgLP86CU
+ gmEY2LlzJyYmJrCwsICuri4lhCAhxP8opT4axzHm5uZUtVolXdeTXYuazSak
+ lNv/Gb93FEBEH2q1WtB1HVJKtFotFUUR1et1XLp0Ka7X6xduvPHGxx5++OET
+ Z86cKV+5cgVRFOHcuXPo6+tLZrmzGRQKheQzEZHinA9ks9lweXlZ+b5PrVYL
+ jDEopcA5h2VZcF13zdWrV9/bLkREX5FSdm3cuLERx7GpaRrpuo4gCH4fBMG3
+ 8vn8ly9evPiqbdu9tm0fHhwcRBiGmJqawosvvphYAWfPnsXJkydx5swZNBoN
+ mKaZiEAYhl+dnZ39raZp5xhj86ZpthzHYaZpeoZhwHGcn1QqlT++6xXYv3+/
+ d/z4cQvAJdd1jzUajW/UarUpIjokpTwjhGjMz88nCWmgWCzihRdewH333YfB
+ wUEIIfD888+DiOB5Hmzbxvbt27G0tISpqSlIKbFp0yYMDQ39+fTp02NBEBAA
+ w3Vdq6ury1BKGUSkLMsqvScLPffcc7dLKTMAzimlvrmwsPBjABdWPvPggw/i
+ qaeegmmaH1tcXIRlWeqVV16hdDqNLVu2oNFowDAMKKWQSqUwNDQEx3FQKpUw
+ NjaW2GkHgLHDhw+r0dHRVqlUapVKpeva3t9WAGNshIgcpdRrk5OTMiH/1lIA
+ ADjnH8pmszh58iSZpomBgQH09/cjm82iUqnAcRxkMhm4rosoinD58mXUajVw
+ zsE5/wSA0bat3p9aaOfOndbMzMzPhRD/GwRBBsDf/YqOHj2KRx55BA888EDe
+ dd2LQgicOnUKYRhCCIE77rgDd999NyzLAhFhcXERJ06cwNTUFHK5HDZt2oTe
+ 3l4YhrEgpbx1dHS09L4JSKfTfc1m803O+R+DIPjo233JQw89dIIx9kmllBof
+ H6e1a9ei2Wzi9OnTiONrE2g2m8Wdd96J+fl5uK6LgYEBZVkWEdEPhoeHD91/
+ //1y7969GBsbe28Cbr31VkxMTKC7u/t71Wr1qwA+oZT6TXJ//fr1OHToEI4e
+ PZqs1EPd3d2jAHQpJRWLRUgpEQQByuUyGGMQQkAp1alEM5kMDMOAYRhIp9Ow
+ LAtKKbGwsPCN6enp7wLArl27MD4+/u4E5HI5lMtljIyMfOT1118/GUXRL03T
+ /Eyz2Wy9dWBfX98HMpnMZ5vN5hdqtZoVBIGybZuy2Swcx4Hv+2g0GgiCoJO9
+ GWMwDKNjqXq9jjiOwTlXruuSpmmCMfaiaZoPTkxMFHbs2NEp399RwMDAAKan
+ p5HP5/sty/rdxYsXPc/zPlUul18G0CmJAWDPnj0HlFLPtEtl5fs+wjAkx3Fg
+ WRYAIAxD1Ov1zuyvyOwdIUophGEIIkoSntI0jdoruH9ycvKX17UL3XvvvTh2
+ 7BgGBwc3uq7703K5vD6dTn+tWCy+vCKhwbbtmxhjH/c870uZTAZRFCmlFCU2
+ ieO4E5qmwTAMCCEghEAURdech2HYaXwSIVJKIiIFgGzb/jaA6xNw7NgxPP74
+ 45mnn376d0S0oVqt/qJSqfw+nU73Mcb2CiFSUsqDtm07cRxvsG2bmaapLMsi
+ pVSHvK7rHYIrS4JEUBzHHRFhGHZIJKvbbnpISok4jnve1Y+4v7//00T0c6WU
+ WlxcJKUUWq1Wp6xuv6DlOE7jtttuM1KplJe0jwmphOzK2U78vzISkcnYJKck
+ 55xzMMbKr7322prrTmQbN278/1Kp9DKAD65Zs4bbtl2fnp6uaZqm6br+h2q1
+ Khhjv9m6devpdevWfbFarR5eSSAhlhxXilppw6Sl5Jxf82xCXCkFKSU0TRPv
+ JhPrp06d6rZt+7tEtCOO4ywR6QBkHMdRtVr9i1JqXggxNT4+XhgeHqbEJkKI
+ DjkAkFJ2SHPOO9eS3ji5l/ifiMA5hxBCSSkJAOI47gi9XgESQMv3/UsAFIA0
+ AAeACUBTSjEAvQDWAOAzMzPb0ul055+GOI7h+75oNptNIoKUktozeQ2LZHbb
+ IhQAJYRQhmGYnucZRNRZDd/3o3aNFLSrgEb7XP6zPEDtFlNrl9kWgBSAbgDZ
+ Nvm1AHp0XV971113bUmn0ykhhDE7O6tNTEyEURSFK8bTW1rW5MViRUQAIsdx
+ 1D333OMZhhEFQeDruu6PjY39X7FYvASgBKAMYAlAvT3uupt6tiI0AHo7jLcc
+ 9fb9hDxfQZ4ls90O2SYRr4ioHeGKSK4nYpPxq1jFKlaxilX85+Cv1id6eRL3
+ 1HwAAAAASUVORK5CYII=
old mode 100644 (file)
new mode 100755 (executable)
index e3a2b07..6327fef
@@ -1,9 +1,9 @@
-This package was debianized by Sudheer K. <scifi.guy@hotmail.com> on
+This package was debianized by Sudheer K. <scifi1947  at gmail.com> on
 Sat,  8 May 2010 13:57:08 -0700.
 
 It was downloaded from https://garage.maemo.org/projects/vicar
 
-Upstream Author: Sudheer K. <scifi.guy@hotmail.com>
+Upstream Author: Sudheer K. <scifi1947 at gmail.com>
 
 Copyright: 2010, Sudheer K.
 
@@ -26,7 +26,7 @@ License:
 On Debian systems, the complete text of the GNU General
 Public License can be found in `/usr/share/common-licenses/GPL'.
 
-The Debian packaging is (C) 2010, Sudheer K. <scifi.guy@hotmail.com> and
+The Debian packaging is (C) 2010, Sudheer K. <scifi1947 at gmail.com> and
 is licensed under the GPL, see above.
 
 
old mode 100644 (file)
new mode 100755 (executable)
index ca882bb..e69de29
@@ -1,2 +0,0 @@
-usr/bin
-usr/sbin
old mode 100644 (file)
new mode 100755 (executable)
index 7ee41dd..a9cf3e7 100644 (file)
@@ -1 +1 @@
-vicar_0.2-1_armel.deb user/network extra
+vicar_0.5-1_armel.deb user/network extra
old mode 100644 (file)
new mode 100755 (executable)
index 56eb403..0b39348
@@ -23,9 +23,39 @@ case "$1" in
 
        # Kill any running instances of the daemon (only used on Linux based systems)
        killall -q vicar-daemon || true
+       killall -q vicar-telepathy || true
+
+        echo "Starting Vicar daemon ..."
+        [[ -x /opt/vicar/vicar-daemon ]] && su - user -c "exec /opt/vicar/vicar-daemon& >/dev/null"
+
+        echo "Starting Vicar-Telepathy ..."
+        [[ -x /opt/vicar/vicar-telepathy ]] && su - user -c "exec /opt/vicar/vicar-telepathy& >/dev/null"
+
+        echo "Removing Vicar launch script..."
+        [[ -x /etc/event.d/launch-vicar ]] && rm -f /etc/event.d/launch-vicar
+
+        echo "Deleting previous release configuration from GConf ..."
+        gconftool-2 --unset /apps/Maemo/vicar/routing_enabled
+        gconftool-2 --unset /apps/Maemo/vicar/calling_card_number
+        gconftool-2 --unset /apps/Maemo/vicar/dtmf_delay
+        gconftool-2 --unset /apps/Maemo/vicar/numbers_to_exclude
+        gconftool-2 --unset /apps/Maemo/vicar/dtmf_format
+        gconftool-2 --unset /apps/Maemo/vicar/dtmf_prefix
+        gconftool-2 --unset /apps/Maemo/vicar/dtmf_suffix
+
+        echo "Creating Vicar Telepathy account ..."
+        [[ -x /opt/vicar/vicar-utils ]] && su - user -c "exec /opt/vicar/vicar-utils INSTALL"
+
+        echo "Updating permissions on Vicar DB file ..."
+        [[ -e /home/user/vicar.db.sqlite ]] && chown user:users /home/user/vicar.db.sqlite
+
+        echo "Creating Vicar Profiles database ..."
+        [[ -x /opt/vicar/vicar-utils ]] && su - user -c "exec /opt/vicar/vicar-utils CREATEDB"
+
+       dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteDialog         string:"Starting with this release, Multiple profiles can be created for routing calls via VICaR.
+
+        Please launch VICaR to setup routing profiles." uint32:0 string:"OK"
 
-        echo "Sarting VICaR daemon ..."
-        [[ -x /opt/vicar/vicar-daemon ]] && exec /opt/vicar/vicar-daemon& >/dev/null
     ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)
old mode 100644 (file)
new mode 100755 (executable)
index ce5c981..f832c85
@@ -25,13 +25,10 @@ case "$1" in
         gconftool-2 --recursive-unset /apps/Maemo/vicar
         echo "Removing logs ..."
         [[ -x /var/log/vicar.log ]] && rm -f /var/log/vicar.log
-       killall -q vicar-daemon || true
     ;;
 
     remove|abort-install)
         echo "Removing unused scripts ..."
-        [[ -x /etc/event.d/launch-vicar ]] && rm -f /etc/event.d/launch-vicar
-       killall -q vicar-daemon || true
     ;;
 
     upgrade|failed-upgrade|abort-upgrade|disappear)
diff --git a/debian/prerm b/debian/prerm
new file mode 100644 (file)
index 0000000..9885c6f
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/sh
+# prerm script for vicar
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <prerm> `remove'
+#        * <old-prerm> `upgrade' <new-version>
+#        * <new-prerm> `failed-upgrade' <old-version>
+#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+#        * <deconfigured's-prerm> `deconfigure' `in-favour'
+#          <package-being-installed> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    remove|deconfigure)
+
+        echo "Deleting Vicar Telepathy account ..."
+        [[ -x /opt/vicar/vicar-utils ]] && su - user -c "exec /opt/vicar/vicar-utils REMOVE"
+
+        echo "Deleting Vicar Profiles database ..."
+        [[ -x /opt/vicar/vicar-utils ]] && su - user -c "exec /opt/vicar/vicar-utils DROPDB"
+
+       # Kill any running instances of the daemon (only used on Linux based systems)
+       killall -q vicar-daemon || true
+       killall -q vicar-telepathy || true
+    ;;
+
+    upgrade)
+       # Kill any running instances of the daemon (only used on Linux based systems)
+       killall -q vicar-daemon || true
+       killall -q vicar-telepathy || true
+    ;;
+
+    failed-upgrade)
+    ;;
+
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
index e90b551..fd099c3 100755 (executable)
@@ -14,7 +14,7 @@ builddir:
        mkdir -p builddir
 
 builddir/Makefile: builddir
-       cd builddir && /opt/qt4-maemo5/bin/qmake ../$(APPNAME).pro
+       cd builddir && qmake ../$(APPNAME).pro
 
 build: build-stamp
 
index 766fde0..cc87600 100644 (file)
@@ -1 +1 @@
-shlibs:Depends=libc6 (>= 2.5.0-1), libgcc1 (>= 1:4.2.1), libgconf2-6 (>= 2.13.5), libglib2.0-0 (>= 2.20.0), libqt4-maemo5-core (>= 4.6.2~git20100212), libqt4-maemo5-dbus (>= 4.6.2~git20100212), libqt4-maemo5-gui (>= 4.6.2~git20100212), libqt4-maemo5-xml (>= 4.6.2~git20100212), libstdc++6 (>= 4.2.1)
+shlibs:Depends=libc6 (>= 2.5.0-1), libgcc1 (>= 1:4.2.1), libgconf2-6 (>= 2.13.5), libglib2.0-0 (>= 2.20.0), libqt4-core (>= 4.6.2~git20100401), libqt4-dbus (>= 4.6.2~git20100401), libqt4-gui (>= 4.6.2~git20100401), libqt4-sql (>= 4.6.2~git20100401), libqt4-xml (>= 4.6.2~git20100401), libstdc++6 (>= 4.2.1)
diff --git a/src/data/icons/26x26/vicar_phone.png b/src/data/icons/26x26/vicar_phone.png
new file mode 100755 (executable)
index 0000000..c28ff95
Binary files /dev/null and b/src/data/icons/26x26/vicar_phone.png differ
diff --git a/src/data/icons/32x32/vicar_phone.png b/src/data/icons/32x32/vicar_phone.png
new file mode 100755 (executable)
index 0000000..5c717bd
Binary files /dev/null and b/src/data/icons/32x32/vicar_phone.png differ
diff --git a/src/data/icons/48x48/vicar_phone.png b/src/data/icons/48x48/vicar_phone.png
new file mode 100755 (executable)
index 0000000..9379353
Binary files /dev/null and b/src/data/icons/48x48/vicar_phone.png differ
diff --git a/src/data/icons/64x64/vicar_phone.png b/src/data/icons/64x64/vicar_phone.png
new file mode 100755 (executable)
index 0000000..1c578a9
Binary files /dev/null and b/src/data/icons/64x64/vicar_phone.png differ
diff --git a/src/data/icons/Icon Source.txt b/src/data/icons/Icon Source.txt
new file mode 100644 (file)
index 0000000..78dd38c
--- /dev/null
@@ -0,0 +1,5 @@
+http://www.iconfinder.com/browse/iconset/DarkGlass_Reworked/#readme
+
+All credits to creators of the icons (Licensed under GPL)
+
+
diff --git a/src/data/icons/vicar-application.png.base64 b/src/data/icons/vicar-application.png.base64
new file mode 100644 (file)
index 0000000..3373c3e
--- /dev/null
@@ -0,0 +1,64 @@
+begin-base64 777 vicar-application.png
+iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c
+6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0
+SU1FB9oIAwM2Kg1VlzwAAApHSURBVGje7VhtbBxX2T3PvfM9s971bhon7iaO
+k7ROrLgpiS3SgigNRUWq3legKEitGkpBohGQIISIUPiDUFWVikJlVQj4QdUK
+FCGIUsTbvqIFRwltCaqw7LbIdWIlthOc9W52vVnv7szOzL2XH+ysnAJtWsof
+8JEezezM3J1z7j17n+dZYBWrWMUqVrGKVazivxf0fn/hwYMHTSGEqWmaJqXk
+UkqmlCKlFGzbhq7rsaZpcRRFwrIs/9FHH41Xjn/sscdw5MiRf5+Affv24fjx
+49dcO3DgwMY4jm/RNO0DSqkhxlgf5zwDoAuABcBQSild1yUR1TjnS1LKq0R0
+jjF2njE2qWnan5544om//NtW4PDhwxgbG8Mbb7wBANi7d+9HOOcHAHw4juMs
+gBQR2UopKKXAGIOmaZ3gnIOIoGkaGGOQUgIANE1DHMc+gCYRXTJN82ddXV0/
+efLJJ8v79u2DEALPPvvsvyagu7sbS0tL2L17t+t53ueFEF/3fT+/vLyMRqOB
+MAwhpYSUEpxzZZomXblyBYwxEBGUUiAiMMbAGAMAeJ6nlFJERCAimKapPM+j
+XC6HVCoFTdN+6HnekWeeeWb57bjx6xEQBAEA5DzP+1V/f//BfD7flU6nIaVU
+pVKJ6vX6m4yxX99www1OPp9f43keHMeBrutIp9Po7e2F67qwbRs333wzLMvC
+tm3baN26dbJYLH6/UqncEARBLp1Oq82bN6O3t5c458O1Wu0u0zR/WygUqv+y
+hWzbPrJ169bv3HLLLcp1XTDGKIoiXLhwAWfPnt12++23XxJCPAVgfyqVwubN
+mxGGIbZs2YK5uTls374dMzMzKBQKsCwLs7Oz4Jyjt7d3w+jo6NYNGzac3L17
+N3K5HBzHUZqmoVar0czMzI/m5ua+PDMzE/8jXuztSDuO87eHGOsFsD8IAhQK
+BapUKtRsNhGGoVpcXITv+19JpVKqu7s729PTgyiKsLy8jCiKUK1WMT8/j1df
+fRVxHGNoaAitVgs33XQT1q5dC6XU5jiO3xRCoFarYXl5GeVymYrFIlWrVVSr
+1fuWl5fXvScLRVEEIrqZiH5BRMNCiI7Xfd+HlJIsy1Lnz58fOX/+fPfIyMh2
+znnPrl27kEqlUC6XkcvlMDw8jPXr12NpaQmFQgH5fB5xHMMwDGiaVn7ppZeK
+YRh+zrIscM4RBAGazSauXr2qLl++bDYajekgCP70jzhq72QdXde/adv2sO/7
+aDabanFxkWq1GjKZDHp6elSlUiEpJVzXvRtA/549e+D7PiYnJzEyMgLP86CU
+gmEY2LlzJyYmJrCwsICuri4lhCAhxP8opT4axzHm5uZUtVolXdeTXYuazSak
+lNv/Gb93FEBEH2q1WtB1HVJKtFotFUUR1et1XLp0Ka7X6xduvPHGxx5++OET
+Z86cKV+5cgVRFOHcuXPo6+tLZrmzGRQKheQzEZHinA9ks9lweXlZ+b5PrVYL
+jDEopcA5h2VZcF13zdWrV9/bLkREX5FSdm3cuLERx7GpaRrpuo4gCH4fBMG3
+8vn8ly9evPiqbdu9tm0fHhwcRBiGmJqawosvvphYAWfPnsXJkydx5swZNBoN
+mKaZiEAYhl+dnZ39raZp5xhj86ZpthzHYaZpeoZhwHGcn1QqlT++6xXYv3+/
+d/z4cQvAJdd1jzUajW/UarUpIjokpTwjhGjMz88nCWmgWCzihRdewH333YfB
+wUEIIfD888+DiOB5Hmzbxvbt27G0tISpqSlIKbFp0yYMDQ39+fTp02NBEBAA
+w3Vdq6ury1BKGUSkLMsqvScLPffcc7dLKTMAzimlvrmwsPBjABdWPvPggw/i
+qaeegmmaH1tcXIRlWeqVV16hdDqNLVu2oNFowDAMKKWQSqUwNDQEx3FQKpUw
+NjaW2GkHgLHDhw+r0dHRVqlUapVKpeva3t9WAGNshIgcpdRrk5OTMiH/1lIA
+ADjnH8pmszh58iSZpomBgQH09/cjm82iUqnAcRxkMhm4rosoinD58mXUajVw
+zsE5/wSA0bat3p9aaOfOndbMzMzPhRD/GwRBBsDf/YqOHj2KRx55BA888EDe
+dd2LQgicOnUKYRhCCIE77rgDd999NyzLAhFhcXERJ06cwNTUFHK5HDZt2oTe
+3l4YhrEgpbx1dHS09L4JSKfTfc1m803O+R+DIPjo233JQw89dIIx9kmllBof
+H6e1a9ei2Wzi9OnTiONrE2g2m8Wdd96J+fl5uK6LgYEBZVkWEdEPhoeHD91/
+//1y7969GBsbe28Cbr31VkxMTKC7u/t71Wr1qwA+oZT6TXJ//fr1OHToEI4e
+PZqs1EPd3d2jAHQpJRWLRUgpEQQByuUyGGMQQkAp1alEM5kMDMOAYRhIp9Ow
+LAtKKbGwsPCN6enp7wLArl27MD4+/u4E5HI5lMtljIyMfOT1118/GUXRL03T
+/Eyz2Wy9dWBfX98HMpnMZ5vN5hdqtZoVBIGybZuy2Swcx4Hv+2g0GgiCoJO9
+GWMwDKNjqXq9jjiOwTlXruuSpmmCMfaiaZoPTkxMFHbs2NEp399RwMDAAKan
+p5HP5/sty/rdxYsXPc/zPlUul18G0CmJAWDPnj0HlFLPtEtl5fs+wjAkx3Fg
+WRYAIAxD1Ov1zuyvyOwdIUophGEIIkoSntI0jdoruH9ycvKX17UL3XvvvTh2
+7BgGBwc3uq7703K5vD6dTn+tWCy+vCKhwbbtmxhjH/c870uZTAZRFCmlFCU2
+ieO4E5qmwTAMCCEghEAURdech2HYaXwSIVJKIiIFgGzb/jaA6xNw7NgxPP74
+45mnn376d0S0oVqt/qJSqfw+nU73Mcb2CiFSUsqDtm07cRxvsG2bmaapLMsi
+pVSHvK7rHYIrS4JEUBzHHRFhGHZIJKvbbnpISok4jnve1Y+4v7//00T0c6WU
+WlxcJKUUWq1Wp6xuv6DlOE7jtttuM1KplJe0jwmphOzK2U78vzISkcnYJKck
+55xzMMbKr7322prrTmQbN278/1Kp9DKAD65Zs4bbtl2fnp6uaZqm6br+h2q1
+Khhjv9m6devpdevWfbFarR5eSSAhlhxXilppw6Sl5Jxf82xCXCkFKSU0TRPv
+JhPrp06d6rZt+7tEtCOO4ywR6QBkHMdRtVr9i1JqXggxNT4+XhgeHqbEJkKI
+DjkAkFJ2SHPOO9eS3ji5l/ifiMA5hxBCSSkJAOI47gi9XgESQMv3/UsAFIA0
+AAeACUBTSjEAvQDWAOAzMzPb0ul055+GOI7h+75oNptNIoKUktozeQ2LZHbb
+IhQAJYRQhmGYnucZRNRZDd/3o3aNFLSrgEb7XP6zPEDtFlNrl9kWgBSAbgDZ
+Nvm1AHp0XV971113bUmn0ykhhDE7O6tNTEyEURSFK8bTW1rW5MViRUQAIsdx
+1D333OMZhhEFQeDruu6PjY39X7FYvASgBKAMYAlAvT3uupt6tiI0AHo7jLcc
+9fb9hDxfQZ4ls90O2SYRr4ioHeGKSK4nYpPxq1jFKlaxilX85+Cv1id6eRL3
+1HwAAAAASUVORK5CYII=
+====
diff --git a/src/data/icons/vicar_application.png b/src/data/icons/vicar_application.png
new file mode 100755 (executable)
index 0000000..2b11887
Binary files /dev/null and b/src/data/icons/vicar_application.png differ
diff --git a/src/data/icons/vicar_scalable_icon.png b/src/data/icons/vicar_scalable_icon.png
new file mode 100755 (executable)
index 0000000..8ad8f4a
Binary files /dev/null and b/src/data/icons/vicar_scalable_icon.png differ
diff --git a/src/data/org.freedesktop.Telepathy.ConnectionManager.vicar.service b/src/data/org.freedesktop.Telepathy.ConnectionManager.vicar.service
new file mode 100644 (file)
index 0000000..8702fca
--- /dev/null
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.freedesktop.Telepathy.ConnectionManager.vicar
+Exec=/opt/vicar/vicar-telepathy
old mode 100644 (file)
new mode 100755 (executable)
index 4e71e50..b39eaaf
@@ -1,5 +1,4 @@
-# Author: Sudheer K.
-# Service description file
 [D-BUS Service]
 Name=org.maemo.vicar
 Exec=/opt/vicar/vicar-daemon
+User=user
old mode 100644 (file)
new mode 100755 (executable)
index b81911b..be24c3c
@@ -5,4 +5,4 @@ Version=1.0
 Type=Application
 Name=Vicar
 Exec=/opt/vicar/vicar-config
-Icon=qgn_list_gene_default_app
+Icon=vicar_scalable_icon
diff --git a/src/data/vicar.manager b/src/data/vicar.manager
new file mode 100644 (file)
index 0000000..bdd8fc0
--- /dev/null
@@ -0,0 +1,24 @@
+[ConnectionManager]
+BusName=org.freedesktop.Telepathy.ConnectionManager.vicar
+ObjectPath=/org/freedesktop/Telepathy/ConnectionManager/vicar
+
+[Protocol tel]
+param-com.nokia.Telepathy.Connection.Interface.GSM.IMSI=s dbus-property
+
+param-com.nokia.Telepathy.Connection.Interface.GSM.Privacy=s dbus-property
+# empty - set by network - let network decide
+# "id"    - no - do not send caller id (by default)
+# "no-id" - yes - send caller id (by default)
+default-com.nokia.Telepathy.Connection.Interface.GSM.Privacy=
+
+# SMS Service Centre
+param-com.nokia.Telepathy.Connection.Interface.GSM.SMSServiceCentre=s dbus-property
+
+# SMS validity period in seconds
+# Range from 300 ... 38102400 (5 minutes to 63 weeks)
+param-com.nokia.Telepathy.Connection.Interface.GSM.SMSValidityPeriod=u  dbus-property
+default-com.nokia.Telepathy.Connection.Interface.GSM.SMSValidityPeriod=0
+
+# Deprecated
+param-account=s
+param-password=s
diff --git a/src/data/vicar.profile b/src/data/vicar.profile
new file mode 100644 (file)
index 0000000..838b9e2
--- /dev/null
@@ -0,0 +1,19 @@
+[Profile]
+DisplayName = Vicar
+IconName = vicar_phone
+Manager = vicar
+Protocol = tel
+Priority = -1
+VCardDefault = 1
+VCardField = X-VICAR
+#SecondaryVCardFields = TEL
+Capabilities = voice-p2p, split-account
+ConfigurationUI = osso-accounts
+LocalizationDomain = rtcom-call-ui
+
+[Action call]
+Name = Call via Vicar
+IconName = vicar_phone
+VCardFields = X-VICAR,TEL
+#SecondaryVCardFields = TEL
+prop-org.freedesktop.Telepathy.Channel.ChannelType-s = org.freedesktop.Telepathy.Channel.Type.StreamedMedia
diff --git a/src/data/xml/connectioninterfacerequestsadaptor.cpp b/src/data/xml/connectioninterfacerequestsadaptor.cpp
new file mode 100644 (file)
index 0000000..4ddb520
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -i ../../connectioninterfacerequeststypes.h -c ConnectionInterfaceRequestsAdaptor -a connectioninterfacerequestsadaptor.h:connectioninterfacerequestsadaptor.cpp org.freedesktop.Telepathy.Connection.I.Requests.xml
+ *
+ * qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#include "connectioninterfacerequestsadaptor.h"
+#include <QtCore/QMetaObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+
+/*
+ * Implementation of adaptor class ConnectionInterfaceRequestsAdaptor
+ */
+
+ConnectionInterfaceRequestsAdaptor::ConnectionInterfaceRequestsAdaptor(QObject *parent)
+    : QDBusAbstractAdaptor(parent)
+{
+    // constructor
+    setAutoRelaySignals(true);
+}
+
+ConnectionInterfaceRequestsAdaptor::~ConnectionInterfaceRequestsAdaptor()
+{
+    // destructor
+}
+
+org::freedesktop::Telepathy::RequestableChannelClassList ConnectionInterfaceRequestsAdaptor::requestableChannelClasses() const
+{
+    // get the value of property RequestableChannelClasses
+    return qvariant_cast< org::freedesktop::Telepathy::RequestableChannelClassList >(parent()->property("RequestableChannelClasses"));
+}
+
+QDBusObjectPath ConnectionInterfaceRequestsAdaptor::CreateChannel(const QVariantMap &request, QVariantMap &channel_properties)
+{
+    // handle method call org.freedesktop.Telepathy.Connection.Interface.Requests.CreateChannel
+    //return static_cast<YourObjectType *>(parent())->CreateChannel(request, channel_properties);
+}
+
+bool ConnectionInterfaceRequestsAdaptor::EnsureChannel(const QVariantMap &request, QDBusObjectPath &channel_object, QVariantMap &channel_properties)
+{
+    // handle method call org.freedesktop.Telepathy.Connection.Interface.Requests.EnsureChannel
+    //return static_cast<YourObjectType *>(parent())->EnsureChannel(request, channel_object, channel_properties);
+}
+
diff --git a/src/data/xml/connectioninterfacerequestsadaptor.h b/src/data/xml/connectioninterfacerequestsadaptor.h
new file mode 100644 (file)
index 0000000..fb99320
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -i ../../connectioninterfacerequeststypes.h -c ConnectionInterfaceRequestsAdaptor -a connectioninterfacerequestsadaptor.h:connectioninterfacerequestsadaptor.cpp org.freedesktop.Telepathy.Connection.I.Requests.xml
+ *
+ * qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#ifndef CONNECTIONINTERFACEREQUESTSADAPTOR_H_1282550631
+#define CONNECTIONINTERFACEREQUESTSADAPTOR_H_1282550631
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+#include "../../connectioninterfacerequeststypes.h"
+class QByteArray;
+template<class T> class QList;
+template<class Key, class Value> class QMap;
+class QString;
+class QStringList;
+class QVariant;
+
+/*
+ * Adaptor class for interface org.freedesktop.Telepathy.Connection.Interface.Requests
+ */
+class ConnectionInterfaceRequestsAdaptor: public QDBusAbstractAdaptor
+{
+    Q_OBJECT
+    Q_CLASSINFO("D-Bus Interface", "org.freedesktop.Telepathy.Connection.Interface.Requests")
+    Q_CLASSINFO("D-Bus Introspection", ""
+"  <interface name=\"org.freedesktop.Telepathy.Connection.Interface.Requests\">\n"
+"    <property access=\"read\" type=\"(a{sv}as)\" name=\"RequestableChannelClasses\">\n"
+"      <annotation value=\"org::freedesktop::Telepathy::RequestableChannelClassList\" name=\"com.trolltech.QtDBus.QtTypeName\"/>\n"
+"    </property>\n"
+"    <method name=\"CreateChannel\">\n"
+"      <annotation value=\"QVariantMap\" name=\"com.trolltech.QtDBus.QtTypeName.In0\"/>\n"
+"      <annotation value=\"QVariantMap\" name=\"com.trolltech.QtDBus.QtTypeName.Out1\"/>\n"
+"      <arg direction=\"in\" type=\"a{sv}\" name=\"request\"/>\n"
+"      <arg direction=\"out\" type=\"o\" name=\"channel_object\"/>\n"
+"      <arg direction=\"out\" type=\"a{sv}\" name=\"channel_properties\"/>\n"
+"    </method>\n"
+"    <method name=\"EnsureChannel\">\n"
+"      <annotation value=\"QVariantMap\" name=\"com.trolltech.QtDBus.QtTypeName.In0\"/>\n"
+"      <annotation value=\"QVariantMap\" name=\"com.trolltech.QtDBus.QtTypeName.Out2\"/>\n"
+"      <arg direction=\"in\" type=\"a{sv}\" name=\"request\"/>\n"
+"      <arg direction=\"out\" type=\"b\" name=\"yours\"/>\n"
+"      <arg direction=\"out\" type=\"o\" name=\"channel_object\"/>\n"
+"      <arg direction=\"out\" type=\"a{sv}\" name=\"channel_properties\"/>\n"
+"    </method>\n"
+"    <signal name=\"NewChannels\">\n"
+"      <annotation value=\"org::freedesktop::Telepathy::ChannelDetailsList\" name=\"com.trolltech.QtDBus.QtTypeName.In0\"/>\n"
+"      <arg type=\"a(oa{sv})\" name=\"new_channels\"/>\n"
+"    </signal>\n"
+"    <signal name=\"ChannelClosed\">\n"
+"      <arg type=\"o\" name=\"removed_channel_object\"/>\n"
+"    </signal>\n"
+"  </interface>\n"
+        "")
+public:
+    ConnectionInterfaceRequestsAdaptor(QObject *parent);
+    virtual ~ConnectionInterfaceRequestsAdaptor();
+
+public: // PROPERTIES
+    Q_PROPERTY(org::freedesktop::Telepathy::RequestableChannelClassList RequestableChannelClasses READ requestableChannelClasses)
+    org::freedesktop::Telepathy::RequestableChannelClassList requestableChannelClasses() const;
+
+public Q_SLOTS: // METHODS
+    QDBusObjectPath CreateChannel(const QVariantMap &request, QVariantMap &channel_properties);
+    bool EnsureChannel(const QVariantMap &request, QDBusObjectPath &channel_object, QVariantMap &channel_properties);
+Q_SIGNALS: // SIGNALS
+    void ChannelClosed(const QDBusObjectPath &removed_channel_object);
+    void NewChannels(org::freedesktop::Telepathy::ChannelDetailsList new_channels);
+};
+
+#endif
diff --git a/src/data/xml/org.freedesktop.Telepathy.Account.xml b/src/data/xml/org.freedesktop.Telepathy.Account.xml
new file mode 100644 (file)
index 0000000..d6c5e5c
--- /dev/null
@@ -0,0 +1,106 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+  <interface name="org.freedesktop.DBus.Introspectable">
+    <method name="Introspect">
+      <arg name="data" direction="out" type="s"/>
+    </method>
+  </interface>
+  <interface name="org.freedesktop.DBus.Properties">
+    <method name="Get">
+      <arg name="interface" direction="in" type="s"/>
+      <arg name="propname" direction="in" type="s"/>
+      <arg name="value" direction="out" type="v"/>
+    </method>
+    <method name="Set">
+      <arg name="interface" direction="in" type="s"/>
+      <arg name="propname" direction="in" type="s"/>
+      <arg name="value" direction="in" type="v"/>
+    </method>
+    <method name="GetAll">
+      <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
+      <arg name="interface" direction="in" type="s"/>
+      <arg name="props" direction="out" type="a{sv}"/>
+    </method>
+  </interface>
+  <interface name="com.nokia.Account.Interface.Stats">
+    <signal name="StatsChanged">
+      <annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="QVariantMap"/>
+      <arg type="a{sv}"/>
+    </signal>
+  </interface>
+  <interface name="com.nokia.Account.Interface.Compat">
+    <method name="SetHasBeenOnline">
+    </method>
+    <signal name="CompatPropertyChanged">
+      <annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="QVariantMap"/>
+      <arg type="a{sv}"/>
+    </signal>
+  </interface>
+  <interface name="com.nokia.Account.Interface.ChannelRequests">
+    <method name="Cancel">
+      <arg name="Request" type="o" direction="in"/>
+    </method>
+    <method name="EnsureChannel">
+      <annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="QVariantMap"/>
+      <arg name="Requested_Properties" type="a{sv}" direction="in"/>
+      <arg name="User_Action_Time" type="t" direction="in"/>
+      <arg name="Preferred_Handler" type="s" direction="in"/>
+      <arg name="Request" type="o" direction="out"/>
+    </method>
+    <method name="Create">
+      <annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="QVariantMap"/>
+      <arg name="Requested_Properties" type="a{sv}" direction="in"/>
+      <arg name="User_Action_Time" type="t" direction="in"/>
+      <arg name="Preferred_Handler" type="s" direction="in"/>
+      <arg name="Request" type="o" direction="out"/>
+    </method>
+    <signal name="Succeeded">
+      <arg type="o"/>
+    </signal>
+    <signal name="Failed">
+      <arg type="o"/>
+      <arg type="s"/>
+      <arg type="s"/>
+    </signal>
+  </interface>
+  <interface name="org.freedesktop.Telepathy.Account.Interface.Avatar">
+    <signal name="AvatarChanged">
+    </signal>
+  </interface>
+  <interface name="org.freedesktop.Telepathy.Account">
+    <method name="Reconnect">
+    </method>
+    <method name="UpdateParameters">
+      <annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="QVariantMap"/>
+      <arg name="Set" type="a{sv}" direction="in"/>
+      <arg name="Unset" type="as" direction="in"/>
+      <arg name="Reconnect_Required" type="as" direction="out"/>
+    </method>
+    <method name="Remove">
+    </method>
+    <signal name="AccountPropertyChanged">
+      <annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="QVariantMap"/>
+      <arg type="a{sv}"/>
+    </signal>
+    <signal name="Removed">
+    </signal>
+  </interface>
+  <interface name="org.freedesktop.DBus.Properties">
+    <method name="GetAll">
+      <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
+      <arg name="Interface_Name" type="s" direction="in"/>
+      <arg name="Properties" type="a{sv}" direction="out"/>
+    </method>
+    <method name="Set">
+      <arg name="Interface_Name" type="s" direction="in"/>
+      <arg name="Property_Name" type="s" direction="in"/>
+      <arg name="Value" type="v" direction="in"/>
+    </method>
+    <method name="Get">
+      <arg name="Interface_Name" type="s" direction="in"/>
+      <arg name="Property_Name" type="s" direction="in"/>
+      <arg name="Value" type="v" direction="out"/>
+    </method>
+  </interface>
+</node>
diff --git a/src/data/xml/org.freedesktop.Telepathy.AccountManager.xml b/src/data/xml/org.freedesktop.Telepathy.AccountManager.xml
new file mode 100644 (file)
index 0000000..883e074
--- /dev/null
@@ -0,0 +1,69 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+  <interface name="org.freedesktop.DBus.Introspectable">
+    <method name="Introspect">
+      <arg name="data" direction="out" type="s"/>
+    </method>
+  </interface>
+  <interface name="org.freedesktop.DBus.Properties">
+    <method name="Get">
+      <arg name="interface" direction="in" type="s"/>
+      <arg name="propname" direction="in" type="s"/>
+      <arg name="value" direction="out" type="v"/>
+    </method>
+    <method name="Set">
+      <arg name="interface" direction="in" type="s"/>
+      <arg name="propname" direction="in" type="s"/>
+      <arg name="value" direction="in" type="v"/>
+    </method>
+    <method name="GetAll">
+      <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
+      <arg name="interface" direction="in" type="s"/>
+      <arg name="props" direction="out" type="a{sv}"/>
+    </method>
+  </interface>
+  <interface name="com.nokia.AccountManager.Interface.Query">
+    <method name="FindAccounts">
+      <annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="QVariantMap"/>
+      <arg name="params" type="a{sv}" direction="in"/>
+      <arg name="accounts" type="ao" direction="out"/>
+    </method>
+  </interface>
+  <interface name="org.freedesktop.Telepathy.AccountManager">
+    <method name="CreateAccount">
+      <annotation name="com.trolltech.QtDBus.QtTypeName.In3" value="QVariantMap"/>
+      <annotation name="com.trolltech.QtDBus.QtTypeName.In4" value="QVariantMap"/>
+      <arg name="Connection_Manager" type="s" direction="in"/>
+      <arg name="Protocol" type="s" direction="in"/>
+      <arg name="Display_Name" type="s" direction="in"/>
+      <arg name="Parameters" type="a{sv}" direction="in"/>
+      <arg name="Properties" type="a{sv}" direction="in"/>
+      <arg name="Account" type="o" direction="out"/>
+    </method>
+    <signal name="AccountValidityChanged">
+      <arg type="o"/>
+      <arg type="b"/>
+    </signal>
+    <signal name="AccountRemoved">
+      <arg type="o"/>
+    </signal>
+  </interface>
+  <interface name="org.freedesktop.DBus.Properties">
+    <method name="GetAll">
+      <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
+      <arg name="Interface_Name" type="s" direction="in"/>
+      <arg name="Properties" type="a{sv}" direction="out"/>
+    </method>
+    <method name="Set">
+      <arg name="Interface_Name" type="s" direction="in"/>
+      <arg name="Property_Name" type="s" direction="in"/>
+      <arg name="Value" type="v" direction="in"/>
+    </method>
+    <method name="Get">
+      <arg name="Interface_Name" type="s" direction="in"/>
+      <arg name="Property_Name" type="s" direction="in"/>
+      <arg name="Value" type="v" direction="out"/>
+    </method>
+  </interface>
+</node>
diff --git a/src/data/xml/org.freedesktop.Telepathy.Connection.I.Requests.xml b/src/data/xml/org.freedesktop.Telepathy.Connection.I.Requests.xml
new file mode 100644 (file)
index 0000000..75d026c
--- /dev/null
@@ -0,0 +1,30 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+  <interface name="org.freedesktop.Telepathy.Connection.Interface.Requests">
+    <property access="read" type="(a{sv}as)" name="RequestableChannelClasses">
+      <annotation name="com.trolltech.QtDBus.QtTypeName" value="org::freedesktop::Telepathy::RequestableChannelClassList"/>    
+    </property>
+    <method name="CreateChannel">
+      <annotation value="QVariantMap" name="com.trolltech.QtDBus.QtTypeName.In0"/>
+      <annotation value="QVariantMap" name="com.trolltech.QtDBus.QtTypeName.Out1"/>
+      <arg direction="in" type="a{sv}" name="request"/>
+      <arg direction="out" type="o" name="channel_object"/>
+      <arg direction="out" type="a{sv}" name="channel_properties"/>
+    </method>
+    <method name="EnsureChannel">
+      <annotation value="QVariantMap" name="com.trolltech.QtDBus.QtTypeName.In0"/>
+      <annotation value="QVariantMap" name="com.trolltech.QtDBus.QtTypeName.Out2"/>
+      <arg direction="in" type="a{sv}" name="request"/>
+      <arg direction="out" type="b" name="yours"/>
+      <arg direction="out" type="o" name="channel_object"/>
+      <arg direction="out" type="a{sv}" name="channel_properties"/>
+    </method>
+    <signal name="NewChannels">
+      <annotation value="org::freedesktop::Telepathy::ChannelDetailsList" name="com.trolltech.QtDBus.QtTypeName.In0"/>
+      <arg type="a(oa{sv})" name="new_channels"/>
+    </signal>
+    <signal name="ChannelClosed">
+      <arg type="o" name="removed_channel_object"/>
+    </signal>
+  </interface>
+</node>
diff --git a/src/data/xml/org.freedesktop.Telepathy.Connection.xml b/src/data/xml/org.freedesktop.Telepathy.Connection.xml
new file mode 100644 (file)
index 0000000..1cd18fc
--- /dev/null
@@ -0,0 +1,112 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+  <interface name="org.freedesktop.Telepathy.Connection" >
+    <property name="Interfaces" type="as" access="read" />
+    <method name="Connect" />
+    <method name="Disconnect" />
+    <method name="GetInterfaces" >
+      <arg direction="out" type="as" />
+    </method>
+    <method name="GetProtocol" >
+      <arg direction="out" type="s" />
+    </method>
+    <method name="GetSelfHandle" >
+      <arg direction="out" type="u" />
+    </method>
+    <method name="GetStatus" >
+      <arg direction="out" type="u" />
+    </method>
+    <method name="HoldHandles" >
+      <annotation value="QList&lt;uint>" name="com.trolltech.QtDBus.QtTypeName.In1" />
+      <arg direction="in" type="u" name="handle_type" />
+      <arg direction="in" type="au" name="handles" />
+    </method>
+    <method name="InspectHandles" >
+      <annotation value="QList&lt;uint>" name="com.trolltech.QtDBus.QtTypeName.In1" />
+      <arg direction="in" type="u" name="handle_type" />
+      <arg direction="in" type="au" name="handles" />
+      <arg direction="out" type="as" />
+    </method>
+    <method name="ListChannels" >
+      <annotation value="org::freedesktop::Telepathy::ChannelInfoList" name="com.trolltech.QtDBus.QtTypeName.Out0" />
+      <arg direction="out" type="a(osuu)" />
+    </method>
+    <method name="ReleaseHandles" >
+      <annotation value="QList&lt;uint>" name="com.trollteh.QtDBus.QtTypeName.In1" />
+      <arg direction="in" type="u" name="handle_type" />
+      <arg direction="in" type="au" name="handles" />
+    </method>
+    <method name="RequestChannel" >
+      <arg direction="in" type="s" name="type" />
+      <arg direction="in" type="u" name="handle_type" />
+      <arg direction="in" type="u" name="handle" />
+      <arg direction="in" type="b" name="suppress_handler" />
+      <arg direction="out" type="o" />
+    </method>
+    <method name="RequestHandles" >
+      <annotation value="QList&lt;uint>" name="com.trolltech.QtDBus.QtTypeName.Out0" />
+      <arg direction="in" type="u" name="handle_type" />
+      <arg direction="in" type="as" name="names" />
+      <arg direction="out" type="au" />
+    </method>
+    <signal name="NewChannel" >
+      <arg type="o" name="object_path" />
+      <arg type="s" name="channel_type" />
+      <arg type="u" name="handle_type" />
+      <arg type="u" name="handle" />
+      <arg type="b" name="suppress_handler" />
+    </signal>
+    <signal name="StatusChanged" >
+      <arg type="u" name="status" />
+      <arg type="u" name="reason" />
+    </signal>
+  </interface>
+  <interface name="org.freedesktop.Telepathy.Connection.Interface.Requests">
+    <property access="read" type="(a{sv}as)" name="RequestableChannelClasses">
+      <annotation name="com.trolltech.QtDBus.QtTypeName" value="org::freedesktop::Telepathy::RequestableChannelClassList"/>    
+    </property>
+    <method name="CreateChannel">
+      <annotation value="QVariantMap" name="com.trolltech.QtDBus.QtTypeName.In0"/>
+      <annotation value="QVariantMap" name="com.trolltech.QtDBus.QtTypeName.Out1"/>
+      <arg direction="in" type="a{sv}" name="request"/>
+      <arg direction="out" type="o" name="channel_object"/>
+      <arg direction="out" type="a{sv}" name="channel_properties"/>
+    </method>
+    <method name="EnsureChannel">
+      <annotation value="QVariantMap" name="com.trolltech.QtDBus.QtTypeName.In0"/>
+      <annotation value="QVariantMap" name="com.trolltech.QtDBus.QtTypeName.Out2"/>
+      <arg direction="in" type="a{sv}" name="request"/>
+      <arg direction="out" type="b" name="yours"/>
+      <arg direction="out" type="o" name="channel_object"/>
+      <arg direction="out" type="a{sv}" name="channel_properties"/>
+    </method>
+    <signal name="NewChannels">
+      <annotation value="org::freedesktop::Telepathy::ChannelDetailsList" name="com.trolltech.QtDBus.QtTypeName.In0"/>
+      <arg type="a(oa{sv})" name="new_channels"/>
+    </signal>
+    <signal name="ChannelClosed">
+      <arg type="o" name="removed_channel_object"/>
+    </signal>
+  </interface>
+ <interface name="org.freedesktop.Telepathy.Connection.Interface.Capabilities">
+    <method name="GetCapabilities">
+      <annotation value="QList&lt;uint&gt;" name="com.trolltech.QtDBus.QtTypeName.In0" />
+      <annotation value="org::freedesktop::Telepathy::ContactCapabilitiesList" name="com.trolltech.QtDBus.QtTypeName.Out0" />
+      <arg name="Handles" type="au" direction="in"/>
+      <arg name="Contact_Capabilities" type="a(usuu)" direction="out"/>
+    </method>
+
+    <method name="AdvertiseCapabilities">
+      <annotation value="org::freedesktop::Telepathy::CapabilityPairList" name="com.trolltech.QtDBus.QtTypeName.In0" />
+      <annotation value="org::freedesktop::Telepathy::CapabilityPairList" name="com.trolltech.QtDBus.QtTypeName.Out0" />
+      <arg name="Add" type="a(su)" direction="in"/>
+      <arg name="Remove" type="as" direction="in"/>
+      <arg name="Self_Capabilities" type="a(su)" direction="out"/>
+    </method>
+
+    <signal name="CapabilitiesChanged">
+      <annotation value="org::freedesktop::Telepathy::CapabilityChangeList" name="com.trolltech.QtDBus.QtTypeName.In0" />
+      <arg type="a(usuuuu)"/>
+    </signal>
+  </interface>
+</node>
diff --git a/src/data/xml/org.maemo.vicar.xml b/src/data/xml/org.maemo.vicar.xml
new file mode 100755 (executable)
index 0000000..0e04435
--- /dev/null
@@ -0,0 +1,21 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+<interface name="org.maemo.vicar">
+       <method name="startOutgoingCallMonitor">
+               <arg direction="out" type="b"/>
+       </method>
+
+       <method name="stopOutgoingCallMonitor">
+               <arg direction="out" type="b"/>
+       </method>
+
+       <method name="isRunning">
+               <arg direction="out" type="b"/>
+       </method>
+
+       <method name="callInternationalNumber">
+            <arg direction="in" type="s" name="number"/>            
+           <arg direction="out" type="s"/>
+      </method>
+</interface>
+</node>
old mode 100644 (file)
new mode 100755 (executable)
index 7d78c54..a0b7ed3
@@ -3,16 +3,37 @@ CONFIG += ordered
 SUBDIRS  += vicar-lib\r
 SUBDIRS  += vicar-daemon\r
 SUBDIRS  += vicar-config\r
+SUBDIRS  += vicar-telepathy\r
+SUBDIRS  += vicar-utils\r
 \r
 #MAKE INSTALL\r
 \r
-INSTALLS += desktop service vicar-up\r
+INSTALLS += desktop service manager profile icon26 icon32 icon48 icon64 scalable\r
 \r
 desktop.path = /usr/share/applications/hildon\r
 desktop.files += data/vicar-config.desktop\r
 \r
 service.path = /usr/share/dbus-1/services\r
 service.files = data/org.maemo.vicar.service\r
+service.files += data/org.freedesktop.Telepathy.ConnectionManager.vicar.service\r
 \r
-vicar-up.path = /etc/event.d/\r
-vicar-up.files = data/event.d/launch-vicar\r
+manager.path = /usr/share/telepathy/managers\r
+manager.files = data/vicar.manager\r
+\r
+profile.path = /usr/share/osso-rtcom\r
+profile.files = data/vicar.profile\r
+\r
+icon26.path = /opt/usr/share/icons/hicolor/26x26/apps\r
+icon26.files += data/icons/26x26/vicar_phone.png\r
+\r
+icon32.path = /opt/usr/share/icons/hicolor/32x32/apps\r
+icon32.files += data/icons/32x32/vicar_phone.png\r
+\r
+icon48.path = /opt/usr/share/icons/hicolor/48x48/apps\r
+icon48.files += data/icons/48x48/vicar_phone.png\r
+\r
+icon64.path = /opt/usr/share/icons/hicolor/64x64/apps\r
+icon64.files += data/icons/64x64/vicar_phone.png\r
+\r
+scalable.path = /opt/usr/share/icons/hicolor/scalable/apps\r
+scalable.files += data/icons/vicar_scalable_icon.png\r
old mode 100644 (file)
new mode 100755 (executable)
index e8b3418..b43a23e
@@ -1,16 +1,21 @@
 /*
-@version: 0.2
-@author: Sudheer K. <scifi.guy@hotmail.com>
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
 @license: GNU General Public License
 */
 
+
 #include <QtGui/QApplication>
-#include "configwindow.h"
+#include "profileswindow.h"
+#include "vicarprofiletypes.h"
+
 int main(int argc, char *argv[])
 {
+    //qDBusRegisterMetaType<org::maemo::vicar::Profile>();
+    //qDBusRegisterMetaType<org::maemo::vicar::ProfileList>();
 
     QApplication a(argc, argv);            
-    ConfigWindow w;
+    ProfilesWindow w;
     w.show();
     return a.exec();
 }
diff --git a/src/vicar-config/src/profilesettingsdialog.cpp b/src/vicar-config/src/profilesettingsdialog.cpp
new file mode 100644 (file)
index 0000000..314e9ca
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+*/
+
+#include "profilesettingsdialog.h"
+#include "ui_profilesettingsdialog.h"
+#include "vicarprofiletypes.h"
+#include <QMessageBox>
+
+ProfileSettingsDialog::ProfileSettingsDialog(QWidget *parent, org::maemo::vicar::Profile *profile) :
+    QDialog(parent),
+    ui(new Ui::ProfileSettingsDialog)
+{
+    ui->setupUi(this);
+    this->profile = profile;
+
+    if (profile != 0){
+        //Load Profile values
+        ui->lineEditNumberStartsWith->setText(profile->phoneNumberPattern);
+        ui->lineEditCallingCardNumber->setText(profile->gatewayNumber);
+        int intIndex = ui->comboBoxDTMFFormat->findText(profile->dtmfFormat);
+        ui->comboBoxDTMFFormat->setCurrentIndex(intIndex);
+        ui->lineEditDTMFPrefix->setText(profile->dtmfPrefix);
+        ui->lineEditDTMFSuffix->setText(profile->dtmfSuffix);
+    }
+
+    ui->lineEditCallingCardNumber->setValidator(new QRegExpValidator(QRegExp( "^-?\\d\\d*$"), this));
+    ui->lineEditDTMFPrefix->setValidator(new QRegExpValidator(QRegExp( "^[0-9p#\\*]*$"), this));
+    ui->lineEditDTMFSuffix->setValidator(new QRegExpValidator(QRegExp( "^[0-9p#\\*]*$"), this));
+}
+
+ProfileSettingsDialog::~ProfileSettingsDialog()
+{
+    delete ui;
+}
+
+
+void ProfileSettingsDialog::on_saveButton_clicked()
+{
+    QString strMessage = QString("");
+    if (profile != 0){
+        QString strNumberStartsWith = ui->lineEditNumberStartsWith->text();
+        if (strNumberStartsWith.isEmpty()){
+            strMessage.append("Enter Phone number starts with\n");
+            ui->lineEditNumberStartsWith->setFocus();
+        }
+
+        QString strCallingCardNumber = ui->lineEditCallingCardNumber->text();
+
+        if (strCallingCardNumber.isEmpty()){
+            strMessage.append("Enter a calling card number\n");
+            ui->lineEditCallingCardNumber->setFocus();
+        }
+
+        if (strMessage.isEmpty()){
+            profile->phoneNumberPattern = ui->lineEditNumberStartsWith->text();
+            profile->gatewayNumber = ui->lineEditCallingCardNumber->text();
+            profile->dtmfFormat = ui->comboBoxDTMFFormat->currentText();
+            profile->dtmfPrefix = ui->lineEditDTMFPrefix->text();
+            profile->dtmfSuffix = ui->lineEditDTMFSuffix->text();
+            this->accept();
+        }
+        else{
+            QMessageBox::warning(this,"Invalid Data",strMessage);
+        }
+    }
+    else{
+        this->accept();
+    }
+}
+
+void ProfileSettingsDialog::on_closeButton_clicked()
+{
+    this->reject();
+}
diff --git a/src/vicar-config/src/profilesettingsdialog.h b/src/vicar-config/src/profilesettingsdialog.h
new file mode 100644 (file)
index 0000000..e73aad4
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+*/
+#ifndef PROFILESETTINGSDIALOG_H
+#define PROFILESETTINGSDIALOG_H
+
+#include <QDialog>
+#include "vicarprofiletypes.h"
+
+namespace Ui {
+    class ProfileSettingsDialog;
+}
+
+class ProfileSettingsDialog : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit ProfileSettingsDialog(QWidget *parent = 0,org::maemo::vicar::Profile *profile = 0);
+    ~ProfileSettingsDialog();
+
+private:
+    Ui::ProfileSettingsDialog *ui;
+    org::maemo::vicar::Profile *profile;
+
+private slots:
+    void on_closeButton_clicked();
+    void on_saveButton_clicked();
+};
+
+#endif // PROFILESETTINGSDIALOG_H
diff --git a/src/vicar-config/src/profileswindow.cpp b/src/vicar-config/src/profileswindow.cpp
new file mode 100644 (file)
index 0000000..78785a8
--- /dev/null
@@ -0,0 +1,195 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+*/
+
+#include "profileswindow.h"
+#include "ui_profileswindow.h"
+#include "profilesettingsdialog.h"
+#include "gconfutility.h"
+#include "dbusutility.h"
+#include "telepathyutility.h"
+#include "databaseutility.h"
+#include <QDebug>
+#include <QDBusMetaType>
+
+class ProfilesWindowPrivate
+{
+public:
+    ProfilesWindowPrivate(ProfilesWindow * p) :
+            gconfUtility(new GConfUtility(p)),
+            dbusUtility(new DbusUtility(p)),
+            tpUtility(new TelepathyUtility(p)),
+            databaseUtility(new DatabaseUtility(p)),
+            parent(p)
+    {
+        databaseUtility->openDatabase();
+
+    }
+
+    ~ProfilesWindowPrivate()
+    {
+        databaseUtility->closeDatabase();
+        qDebug() << "VICaR: ProfilesWindowPrivate Destructing";
+    }
+
+    GConfUtility * gconfUtility;
+    DbusUtility * dbusUtility;
+    TelepathyUtility *tpUtility;
+    DatabaseUtility *databaseUtility;
+    org::maemo::vicar::Profile *profile;
+    ProfilesWindow * const parent;
+};
+
+// ---------------------------------------------------------------------------
+
+ProfilesWindow::ProfilesWindow(QWidget *parent) :
+    QMainWindow(parent),
+    ui(new Ui::ProfilesWindow),
+    d(new ProfilesWindowPrivate(this))
+{
+    ui->setupUi(this);
+    loadProfilesList();
+
+    ui->actionRoutingEnabled->setChecked(d->tpUtility->accountExists());
+
+    bool routeOnDefault = d->gconfUtility->getGconfValueBoolean("route_on_default");
+    ui->actionRouteOnDefault->setChecked(routeOnDefault);
+
+}
+
+ProfilesWindow::~ProfilesWindow()
+{
+    delete ui;
+}
+
+void ProfilesWindow::loadProfilesList(){
+    org::maemo::vicar::ProfileList profileList;
+    bool result = d->databaseUtility->getAllProfiles(&profileList);
+    if (!result){
+        d->dbusUtility->displayNotification("Unable to get profiles list.");
+        qDebug() << "Error fetching profiles list. "<< d->databaseUtility->lastError();
+    }
+    else{
+        //ui->profilesListWidget->clear();
+        org::maemo::vicar::Profile currentProfile;
+        foreach (currentProfile,profileList){
+            QString strProfileDetails = QString("Number starts with %1 then call via %2")
+                                        .arg(currentProfile.phoneNumberPattern)
+                                        .arg(currentProfile.gatewayNumber);
+            QListWidgetItem *item = new QListWidgetItem(strProfileDetails,ui->profilesListWidget);
+            item->setData(Qt::UserRole,currentProfile.profileID);
+        }
+    }
+}
+
+void ProfilesWindow::on_addButton_clicked()
+{
+    org::maemo::vicar::Profile newProfile;
+    ProfileSettingsDialog *dialog = new ProfileSettingsDialog(this,&newProfile);
+    int result = dialog->exec();
+    if (result == QDialog::Accepted){
+        qDebug() << "Inserting new profile record";
+        int result = d->databaseUtility->insertProfile(newProfile);
+        if (result == -1){
+            d->dbusUtility->displayNotification("Unable to create new profile.");
+            qDebug() << "Error inserting new profile record. "<< d->databaseUtility->lastError();
+        }
+        else{
+            QString strProfileDetails = QString("Number starts with %1 then call via %2")
+                                        .arg(newProfile.phoneNumberPattern)
+                                        .arg(newProfile.gatewayNumber);
+            QListWidgetItem *item = new QListWidgetItem(strProfileDetails,ui->profilesListWidget);
+            item->setData(Qt::UserRole,result);
+        }
+    }
+}
+
+void ProfilesWindow::on_editButton_clicked(){
+    QListWidgetItem *item = ui->profilesListWidget->currentItem();
+    if (item != 0){
+        int intProfileID = item->data(Qt::UserRole).toInt();
+        org::maemo::vicar::Profile profile;
+        bool result = d->databaseUtility->selectProfile(intProfileID,&profile);
+        if (!result){
+            d->dbusUtility->displayNotification("Unable to fetch profile details.");
+            qDebug() << "Error fetching profile record for id "<< intProfileID
+                    <<". "<< d->databaseUtility->lastError();
+        }
+        else{
+            ProfileSettingsDialog *dialog = new ProfileSettingsDialog(this,&profile);
+            int response = dialog->exec();
+            if (response == QDialog::Accepted){
+                qDebug() << "Updating profile record";
+                bool result = d->databaseUtility->updateProfile(profile);
+                if (!result){
+                    d->dbusUtility->displayNotification("Unable to update profile.");
+                    qDebug() << "Error fetching profile record for id "<< intProfileID
+                            <<". "<< d->databaseUtility->lastError();
+                }
+                else{
+                    QString strProfileDetails = QString("Number starts with %1 then \n call via %2")
+                                                .arg(profile.phoneNumberPattern)
+                                                .arg(profile.gatewayNumber);
+                    item->setText(strProfileDetails);
+                    item->setData(Qt::UserRole,result);
+                }
+            }
+        }
+    }
+    else{
+        d->dbusUtility->displayNotification("Select a profile to edit.");
+    }
+}
+
+void ProfilesWindow::on_removeButton_clicked(){
+    QListWidgetItem *item = ui->profilesListWidget->currentItem();
+    if (item != 0){
+        int intProfileID = item->data(Qt::UserRole).toInt();
+        bool result = d->databaseUtility->deleteProfile(intProfileID);
+        if (!result){
+            d->dbusUtility->displayNotification("Unable to delete profile.");
+            qDebug() << "Error deleting profile record for id "<< intProfileID
+                    <<". "<< d->databaseUtility->lastError();
+        }
+        else{
+            //ui->profilesListWidget->removeItemWidget(item);
+            ui->profilesListWidget->clear();
+            this->loadProfilesList();
+        }
+    }
+    else{
+        d->dbusUtility->displayNotification("Select a profile to delete.");
+    }
+}
+
+void ProfilesWindow::on_actionRoutingEnabled_triggered(bool checked){
+
+    qDBusRegisterMetaType<org::freedesktop::Telepathy::SimplePresence>();
+
+    bool result;
+
+    if (checked){
+        if (!d->tpUtility->accountExists()){
+            result = d->tpUtility->createAccount();
+            if (!result){
+                d->dbusUtility->displayNotification("Unable to enable call routing.");
+                ui->actionRoutingEnabled->setChecked(false);
+            }
+        }
+    }
+    else{
+        if (d->tpUtility->accountExists()){
+            result = d->tpUtility->deleteAccount();
+            if (!result){
+                d->dbusUtility->displayNotification("Unable to disable call routing.");
+                ui->actionRoutingEnabled->setChecked(true);
+            }
+        }
+    }
+}
+
+void ProfilesWindow::on_actionRouteOnDefault_triggered(bool checked){
+    d->gconfUtility->setGconfValueBoolean("route_on_default",checked);
+}
diff --git a/src/vicar-config/src/profileswindow.h b/src/vicar-config/src/profileswindow.h
new file mode 100644 (file)
index 0000000..3075ac7
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+*/
+#ifndef PROFILESWINDOW_H
+#define PROFILESWINDOW_H
+
+#include <QMainWindow>
+
+namespace Ui {
+    class ProfilesWindow;
+}
+
+class ProfilesWindowPrivate;
+
+class ProfilesWindow : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    explicit ProfilesWindow(QWidget *parent = 0);
+    ~ProfilesWindow();
+    void loadProfilesList();
+
+private:
+    Ui::ProfilesWindow *ui;
+    ProfilesWindowPrivate * const d;
+
+private slots:
+    void on_addButton_clicked();
+    void on_editButton_clicked();
+    void on_removeButton_clicked();
+    void on_actionRoutingEnabled_triggered(bool checked);
+    void on_actionRouteOnDefault_triggered(bool checked);
+};
+
+#endif // PROFILESWINDOW_H
diff --git a/src/vicar-config/uis/profilesettingsdialog.ui b/src/vicar-config/uis/profilesettingsdialog.ui
new file mode 100644 (file)
index 0000000..f55f5ee
--- /dev/null
@@ -0,0 +1,312 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ProfileSettingsDialog</class>
+ <widget class="QDialog" name="ProfileSettingsDialog">
+  <property name="windowModality">
+   <enum>Qt::ApplicationModal</enum>
+  </property>
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>400</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Edit Profile</string>
+  </property>
+  <property name="modal">
+   <bool>true</bool>
+  </property>
+  <widget class="QScrollArea" name="scrollArea">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>10</y>
+     <width>681</width>
+     <height>371</height>
+    </rect>
+   </property>
+   <property name="widgetResizable">
+    <bool>true</bool>
+   </property>
+   <widget class="QWidget" name="scrollAreaWidgetContents">
+    <property name="geometry">
+     <rect>
+      <x>0</x>
+      <y>0</y>
+      <width>679</width>
+      <height>369</height>
+     </rect>
+    </property>
+    <widget class="QWidget" name="formLayoutWidget">
+     <property name="geometry">
+      <rect>
+       <x>10</x>
+       <y>10</y>
+       <width>661</width>
+       <height>351</height>
+      </rect>
+     </property>
+     <layout class="QFormLayout" name="formLayoutBasic">
+      <property name="fieldGrowthPolicy">
+       <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+      </property>
+      <property name="leftMargin">
+       <number>10</number>
+      </property>
+      <item row="0" column="0">
+       <widget class="QLabel" name="labelNumberStartsWith">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>280</width>
+          <height>25</height>
+         </size>
+        </property>
+        <property name="maximumSize">
+         <size>
+          <width>280</width>
+          <height>16777215</height>
+         </size>
+        </property>
+        <property name="text">
+         <string>Number starts with:</string>
+        </property>
+        <property name="margin">
+         <number>0</number>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QLineEdit" name="lineEditNumberStartsWith">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>60</height>
+         </size>
+        </property>
+        <property name="inputMethodHints">
+         <set>Qt::ImhDigitsOnly</set>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="labelCallingCardNumber">
+        <property name="text">
+         <string>Calling Card Number:</string>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QLineEdit" name="lineEditCallingCardNumber">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>60</height>
+         </size>
+        </property>
+        <property name="inputMethodHints">
+         <set>Qt::ImhDigitsOnly</set>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="0">
+       <widget class="QLabel" name="labelDTMFFormat">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>280</width>
+          <height>25</height>
+         </size>
+        </property>
+        <property name="maximumSize">
+         <size>
+          <width>280</width>
+          <height>16777215</height>
+         </size>
+        </property>
+        <property name="text">
+         <string>Format required for DTMF tone:</string>
+        </property>
+        <property name="wordWrap">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item row="2" column="1">
+       <widget class="QComboBox" name="comboBoxDTMFFormat">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>50</width>
+          <height>60</height>
+         </size>
+        </property>
+        <item>
+         <property name="text">
+          <string>&lt;Country Code&gt;&lt;Area Code&gt;&lt;Phone Number&gt;</string>
+         </property>
+        </item>
+        <item>
+         <property name="text">
+          <string>+&lt;Country Code&gt;&lt;Area Code&gt;&lt;Phone Number&gt;</string>
+         </property>
+        </item>
+        <item>
+         <property name="text">
+          <string>00&lt;Country Code&gt;&lt;Area Code&gt;&lt;Phone Number&gt;</string>
+         </property>
+        </item>
+        <item>
+         <property name="text">
+          <string>011&lt;Country Code&gt;&lt;Area Code&gt;&lt;Phone Number&gt;</string>
+         </property>
+        </item>
+       </widget>
+      </item>
+      <item row="3" column="0">
+       <widget class="QLabel" name="labelDTMFPrefix">
+        <property name="text">
+         <string>Prefix before DTMF tone:</string>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="1">
+       <widget class="QLineEdit" name="lineEditDTMFPrefix">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>60</height>
+         </size>
+        </property>
+        <property name="inputMethodHints">
+         <set>Qt::ImhDialableCharactersOnly|Qt::ImhLowercaseOnly|Qt::ImhNoAutoUppercase|Qt::ImhNoPredictiveText|Qt::ImhPreferLowercase|Qt::ImhPreferNumbers</set>
+        </property>
+       </widget>
+      </item>
+      <item row="4" column="0">
+       <widget class="QLabel" name="labelDTMFSuffix">
+        <property name="text">
+         <string>Suffix after DTMF tone:</string>
+        </property>
+       </widget>
+      </item>
+      <item row="4" column="1">
+       <widget class="QLineEdit" name="lineEditDTMFSuffix">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>0</width>
+          <height>60</height>
+         </size>
+        </property>
+        <property name="inputMethodHints">
+         <set>Qt::ImhDialableCharactersOnly|Qt::ImhLowercaseOnly|Qt::ImhNoAutoUppercase|Qt::ImhNoPredictiveText|Qt::ImhPreferLowercase|Qt::ImhPreferNumbers</set>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </widget>
+  </widget>
+  <widget class="QWidget" name="layoutWidget">
+   <property name="geometry">
+    <rect>
+     <x>696</x>
+     <y>22</y>
+     <width>101</width>
+     <height>124</height>
+    </rect>
+   </property>
+   <layout class="QVBoxLayout" name="verticalLayout">
+    <item>
+     <widget class="QPushButton" name="saveButton">
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+      <property name="minimumSize">
+       <size>
+        <width>0</width>
+        <height>40</height>
+       </size>
+      </property>
+      <property name="text">
+       <string>Save</string>
+      </property>
+     </widget>
+    </item>
+    <item>
+     <spacer name="verticalSpacer">
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+      <property name="sizeHint" stdset="0">
+       <size>
+        <width>17</width>
+        <height>30</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
+    <item>
+     <widget class="QPushButton" name="closeButton">
+      <property name="minimumSize">
+       <size>
+        <width>0</width>
+        <height>40</height>
+       </size>
+      </property>
+      <property name="text">
+       <string>Close</string>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/vicar-config/uis/profileswindow.ui b/src/vicar-config/uis/profileswindow.ui
new file mode 100644 (file)
index 0000000..8a76e4f
--- /dev/null
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ProfilesWindow</class>
+ <widget class="QMainWindow" name="ProfilesWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>800</width>
+    <height>480</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>VICaR - Profiles</string>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <widget class="QWidget" name="layoutWidget">
+    <property name="geometry">
+     <rect>
+      <x>31</x>
+      <y>11</y>
+      <width>741</width>
+      <height>411</height>
+     </rect>
+    </property>
+    <layout class="QVBoxLayout" name="verticalLayout">
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout">
+       <item>
+        <widget class="QPushButton" name="addButton">
+         <property name="text">
+          <string>Add</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer name="horizontalSpacer1">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>58</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QPushButton" name="editButton">
+         <property name="text">
+          <string>Edit</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer name="horizontalSpacer2">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>58</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QPushButton" name="removeButton">
+         <property name="text">
+          <string>Remove</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <spacer name="verticalSpacer">
+       <property name="orientation">
+        <enum>Qt::Vertical</enum>
+       </property>
+       <property name="sizeType">
+        <enum>QSizePolicy::Fixed</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>20</width>
+         <height>10</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QListWidget" name="profilesListWidget">
+       <property name="alternatingRowColors">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </widget>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>800</width>
+     <height>23</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menuVicarProfiles">
+    <property name="title">
+     <string>VICaR - Profiles</string>
+    </property>
+    <addaction name="actionRoutingEnabled"/>
+    <addaction name="actionRouteOnDefault"/>
+   </widget>
+   <addaction name="menuVicarProfiles"/>
+  </widget>
+  <action name="actionRoutingEnabled">
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
+   <property name="text">
+    <string>Routing Enabled</string>
+   </property>
+   <property name="toolTip">
+    <string>Call Routing Enabled?</string>
+   </property>
+  </action>
+  <action name="actionRouteOnDefault">
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
+   <property name="text">
+    <string>Call Directly on Default</string>
+   </property>
+   <property name="toolTip">
+    <string>Call directly if no match found?</string>
+   </property>
+  </action>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/vicar-config/uis/ui_profilesettingsdialog.h b/src/vicar-config/uis/ui_profilesettingsdialog.h
new file mode 100644 (file)
index 0000000..edc0067
--- /dev/null
@@ -0,0 +1,224 @@
+/********************************************************************************
+** Form generated from reading UI file 'profilesettingsdialog.ui'
+**
+** Created: Tue Sep 7 04:21:07 2010
+**      by: Qt User Interface Compiler version 4.6.2
+**
+** WARNING! All changes made in this file will be lost when recompiling UI file!
+********************************************************************************/
+
+#ifndef UI_PROFILESETTINGSDIALOG_H
+#define UI_PROFILESETTINGSDIALOG_H
+
+#include <QtCore/QVariant>
+#include <QtGui/QAction>
+#include <QtGui/QApplication>
+#include <QtGui/QButtonGroup>
+#include <QtGui/QComboBox>
+#include <QtGui/QDialog>
+#include <QtGui/QFormLayout>
+#include <QtGui/QHeaderView>
+#include <QtGui/QLabel>
+#include <QtGui/QLineEdit>
+#include <QtGui/QPushButton>
+#include <QtGui/QScrollArea>
+#include <QtGui/QSpacerItem>
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QWidget>
+
+QT_BEGIN_NAMESPACE
+
+class Ui_ProfileSettingsDialog
+{
+public:
+    QScrollArea *scrollArea;
+    QWidget *scrollAreaWidgetContents;
+    QWidget *formLayoutWidget;
+    QFormLayout *formLayoutBasic;
+    QLabel *labelNumberStartsWith;
+    QLineEdit *lineEditNumberStartsWith;
+    QLabel *labelCallingCardNumber;
+    QLineEdit *lineEditCallingCardNumber;
+    QLabel *labelDTMFFormat;
+    QComboBox *comboBoxDTMFFormat;
+    QLabel *labelDTMFPrefix;
+    QLineEdit *lineEditDTMFPrefix;
+    QLabel *labelDTMFSuffix;
+    QLineEdit *lineEditDTMFSuffix;
+    QWidget *layoutWidget;
+    QVBoxLayout *verticalLayout;
+    QPushButton *saveButton;
+    QSpacerItem *verticalSpacer;
+    QPushButton *closeButton;
+
+    void setupUi(QDialog *ProfileSettingsDialog)
+    {
+        if (ProfileSettingsDialog->objectName().isEmpty())
+            ProfileSettingsDialog->setObjectName(QString::fromUtf8("ProfileSettingsDialog"));
+        ProfileSettingsDialog->setWindowModality(Qt::ApplicationModal);
+        ProfileSettingsDialog->resize(800, 400);
+        ProfileSettingsDialog->setModal(true);
+        scrollArea = new QScrollArea(ProfileSettingsDialog);
+        scrollArea->setObjectName(QString::fromUtf8("scrollArea"));
+        scrollArea->setGeometry(QRect(0, 10, 681, 371));
+        scrollArea->setWidgetResizable(true);
+        scrollAreaWidgetContents = new QWidget();
+        scrollAreaWidgetContents->setObjectName(QString::fromUtf8("scrollAreaWidgetContents"));
+        scrollAreaWidgetContents->setGeometry(QRect(0, 0, 679, 369));
+        formLayoutWidget = new QWidget(scrollAreaWidgetContents);
+        formLayoutWidget->setObjectName(QString::fromUtf8("formLayoutWidget"));
+        formLayoutWidget->setGeometry(QRect(10, 10, 661, 351));
+        formLayoutBasic = new QFormLayout(formLayoutWidget);
+        formLayoutBasic->setObjectName(QString::fromUtf8("formLayoutBasic"));
+        formLayoutBasic->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
+        formLayoutBasic->setContentsMargins(10, 0, 0, 0);
+        labelNumberStartsWith = new QLabel(formLayoutWidget);
+        labelNumberStartsWith->setObjectName(QString::fromUtf8("labelNumberStartsWith"));
+        QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
+        sizePolicy.setHorizontalStretch(0);
+        sizePolicy.setVerticalStretch(0);
+        sizePolicy.setHeightForWidth(labelNumberStartsWith->sizePolicy().hasHeightForWidth());
+        labelNumberStartsWith->setSizePolicy(sizePolicy);
+        labelNumberStartsWith->setMinimumSize(QSize(280, 25));
+        labelNumberStartsWith->setMaximumSize(QSize(280, 16777215));
+        labelNumberStartsWith->setMargin(0);
+
+        formLayoutBasic->setWidget(0, QFormLayout::LabelRole, labelNumberStartsWith);
+
+        lineEditNumberStartsWith = new QLineEdit(formLayoutWidget);
+        lineEditNumberStartsWith->setObjectName(QString::fromUtf8("lineEditNumberStartsWith"));
+        QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Fixed);
+        sizePolicy1.setHorizontalStretch(0);
+        sizePolicy1.setVerticalStretch(0);
+        sizePolicy1.setHeightForWidth(lineEditNumberStartsWith->sizePolicy().hasHeightForWidth());
+        lineEditNumberStartsWith->setSizePolicy(sizePolicy1);
+        lineEditNumberStartsWith->setMinimumSize(QSize(0, 60));
+        lineEditNumberStartsWith->setInputMethodHints(Qt::ImhDigitsOnly);
+
+        formLayoutBasic->setWidget(0, QFormLayout::FieldRole, lineEditNumberStartsWith);
+
+        labelCallingCardNumber = new QLabel(formLayoutWidget);
+        labelCallingCardNumber->setObjectName(QString::fromUtf8("labelCallingCardNumber"));
+
+        formLayoutBasic->setWidget(1, QFormLayout::LabelRole, labelCallingCardNumber);
+
+        lineEditCallingCardNumber = new QLineEdit(formLayoutWidget);
+        lineEditCallingCardNumber->setObjectName(QString::fromUtf8("lineEditCallingCardNumber"));
+        sizePolicy1.setHeightForWidth(lineEditCallingCardNumber->sizePolicy().hasHeightForWidth());
+        lineEditCallingCardNumber->setSizePolicy(sizePolicy1);
+        lineEditCallingCardNumber->setMinimumSize(QSize(0, 60));
+        lineEditCallingCardNumber->setInputMethodHints(Qt::ImhDigitsOnly);
+
+        formLayoutBasic->setWidget(1, QFormLayout::FieldRole, lineEditCallingCardNumber);
+
+        labelDTMFFormat = new QLabel(formLayoutWidget);
+        labelDTMFFormat->setObjectName(QString::fromUtf8("labelDTMFFormat"));
+        sizePolicy.setHeightForWidth(labelDTMFFormat->sizePolicy().hasHeightForWidth());
+        labelDTMFFormat->setSizePolicy(sizePolicy);
+        labelDTMFFormat->setMinimumSize(QSize(280, 25));
+        labelDTMFFormat->setMaximumSize(QSize(280, 16777215));
+        labelDTMFFormat->setWordWrap(true);
+
+        formLayoutBasic->setWidget(2, QFormLayout::LabelRole, labelDTMFFormat);
+
+        comboBoxDTMFFormat = new QComboBox(formLayoutWidget);
+        comboBoxDTMFFormat->setObjectName(QString::fromUtf8("comboBoxDTMFFormat"));
+        QSizePolicy sizePolicy2(QSizePolicy::Minimum, QSizePolicy::Minimum);
+        sizePolicy2.setHorizontalStretch(0);
+        sizePolicy2.setVerticalStretch(0);
+        sizePolicy2.setHeightForWidth(comboBoxDTMFFormat->sizePolicy().hasHeightForWidth());
+        comboBoxDTMFFormat->setSizePolicy(sizePolicy2);
+        comboBoxDTMFFormat->setMinimumSize(QSize(50, 60));
+
+        formLayoutBasic->setWidget(2, QFormLayout::FieldRole, comboBoxDTMFFormat);
+
+        labelDTMFPrefix = new QLabel(formLayoutWidget);
+        labelDTMFPrefix->setObjectName(QString::fromUtf8("labelDTMFPrefix"));
+
+        formLayoutBasic->setWidget(3, QFormLayout::LabelRole, labelDTMFPrefix);
+
+        lineEditDTMFPrefix = new QLineEdit(formLayoutWidget);
+        lineEditDTMFPrefix->setObjectName(QString::fromUtf8("lineEditDTMFPrefix"));
+        sizePolicy1.setHeightForWidth(lineEditDTMFPrefix->sizePolicy().hasHeightForWidth());
+        lineEditDTMFPrefix->setSizePolicy(sizePolicy1);
+        lineEditDTMFPrefix->setMinimumSize(QSize(0, 60));
+        lineEditDTMFPrefix->setInputMethodHints(Qt::ImhDialableCharactersOnly|Qt::ImhLowercaseOnly|Qt::ImhNoAutoUppercase|Qt::ImhNoPredictiveText|Qt::ImhPreferLowercase|Qt::ImhPreferNumbers);
+
+        formLayoutBasic->setWidget(3, QFormLayout::FieldRole, lineEditDTMFPrefix);
+
+        labelDTMFSuffix = new QLabel(formLayoutWidget);
+        labelDTMFSuffix->setObjectName(QString::fromUtf8("labelDTMFSuffix"));
+
+        formLayoutBasic->setWidget(4, QFormLayout::LabelRole, labelDTMFSuffix);
+
+        lineEditDTMFSuffix = new QLineEdit(formLayoutWidget);
+        lineEditDTMFSuffix->setObjectName(QString::fromUtf8("lineEditDTMFSuffix"));
+        sizePolicy1.setHeightForWidth(lineEditDTMFSuffix->sizePolicy().hasHeightForWidth());
+        lineEditDTMFSuffix->setSizePolicy(sizePolicy1);
+        lineEditDTMFSuffix->setMinimumSize(QSize(0, 60));
+        lineEditDTMFSuffix->setInputMethodHints(Qt::ImhDialableCharactersOnly|Qt::ImhLowercaseOnly|Qt::ImhNoAutoUppercase|Qt::ImhNoPredictiveText|Qt::ImhPreferLowercase|Qt::ImhPreferNumbers);
+
+        formLayoutBasic->setWidget(4, QFormLayout::FieldRole, lineEditDTMFSuffix);
+
+        scrollArea->setWidget(scrollAreaWidgetContents);
+        layoutWidget = new QWidget(ProfileSettingsDialog);
+        layoutWidget->setObjectName(QString::fromUtf8("layoutWidget"));
+        layoutWidget->setGeometry(QRect(696, 22, 101, 124));
+        verticalLayout = new QVBoxLayout(layoutWidget);
+        verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
+        verticalLayout->setContentsMargins(0, 0, 0, 0);
+        saveButton = new QPushButton(layoutWidget);
+        saveButton->setObjectName(QString::fromUtf8("saveButton"));
+        QSizePolicy sizePolicy3(QSizePolicy::Minimum, QSizePolicy::Fixed);
+        sizePolicy3.setHorizontalStretch(0);
+        sizePolicy3.setVerticalStretch(0);
+        sizePolicy3.setHeightForWidth(saveButton->sizePolicy().hasHeightForWidth());
+        saveButton->setSizePolicy(sizePolicy3);
+        saveButton->setMinimumSize(QSize(0, 40));
+
+        verticalLayout->addWidget(saveButton);
+
+        verticalSpacer = new QSpacerItem(17, 30, QSizePolicy::Minimum, QSizePolicy::Expanding);
+
+        verticalLayout->addItem(verticalSpacer);
+
+        closeButton = new QPushButton(layoutWidget);
+        closeButton->setObjectName(QString::fromUtf8("closeButton"));
+        closeButton->setMinimumSize(QSize(0, 40));
+
+        verticalLayout->addWidget(closeButton);
+
+
+        retranslateUi(ProfileSettingsDialog);
+
+        QMetaObject::connectSlotsByName(ProfileSettingsDialog);
+    } // setupUi
+
+    void retranslateUi(QDialog *ProfileSettingsDialog)
+    {
+        ProfileSettingsDialog->setWindowTitle(QApplication::translate("ProfileSettingsDialog", "Edit Profile", 0, QApplication::UnicodeUTF8));
+        labelNumberStartsWith->setText(QApplication::translate("ProfileSettingsDialog", "Number starts with:", 0, QApplication::UnicodeUTF8));
+        labelCallingCardNumber->setText(QApplication::translate("ProfileSettingsDialog", "Calling Card Number:", 0, QApplication::UnicodeUTF8));
+        labelDTMFFormat->setText(QApplication::translate("ProfileSettingsDialog", "Format required for DTMF tone:", 0, QApplication::UnicodeUTF8));
+        comboBoxDTMFFormat->clear();
+        comboBoxDTMFFormat->insertItems(0, QStringList()
+         << QApplication::translate("ProfileSettingsDialog", "<Country Code><Area Code><Phone Number>", 0, QApplication::UnicodeUTF8)
+         << QApplication::translate("ProfileSettingsDialog", "+<Country Code><Area Code><Phone Number>", 0, QApplication::UnicodeUTF8)
+         << QApplication::translate("ProfileSettingsDialog", "00<Country Code><Area Code><Phone Number>", 0, QApplication::UnicodeUTF8)
+         << QApplication::translate("ProfileSettingsDialog", "011<Country Code><Area Code><Phone Number>", 0, QApplication::UnicodeUTF8)
+        );
+        labelDTMFPrefix->setText(QApplication::translate("ProfileSettingsDialog", "Prefix before DTMF tone:", 0, QApplication::UnicodeUTF8));
+        labelDTMFSuffix->setText(QApplication::translate("ProfileSettingsDialog", "Suffix after DTMF tone:", 0, QApplication::UnicodeUTF8));
+        saveButton->setText(QApplication::translate("ProfileSettingsDialog", "Save", 0, QApplication::UnicodeUTF8));
+        closeButton->setText(QApplication::translate("ProfileSettingsDialog", "Close", 0, QApplication::UnicodeUTF8));
+    } // retranslateUi
+
+};
+
+namespace Ui {
+    class ProfileSettingsDialog: public Ui_ProfileSettingsDialog {};
+} // namespace Ui
+
+QT_END_NAMESPACE
+
+#endif // UI_PROFILESETTINGSDIALOG_H
diff --git a/src/vicar-config/uis/ui_profileswindow.h b/src/vicar-config/uis/ui_profileswindow.h
new file mode 100644 (file)
index 0000000..289dcdf
--- /dev/null
@@ -0,0 +1,148 @@
+/********************************************************************************
+** Form generated from reading UI file 'profileswindow.ui'
+**
+** Created: Tue Sep 7 04:21:07 2010
+**      by: Qt User Interface Compiler version 4.6.2
+**
+** WARNING! All changes made in this file will be lost when recompiling UI file!
+********************************************************************************/
+
+#ifndef UI_PROFILESWINDOW_H
+#define UI_PROFILESWINDOW_H
+
+#include <QtCore/QVariant>
+#include <QtGui/QAction>
+#include <QtGui/QApplication>
+#include <QtGui/QButtonGroup>
+#include <QtGui/QHBoxLayout>
+#include <QtGui/QHeaderView>
+#include <QtGui/QListWidget>
+#include <QtGui/QMainWindow>
+#include <QtGui/QMenu>
+#include <QtGui/QMenuBar>
+#include <QtGui/QPushButton>
+#include <QtGui/QSpacerItem>
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QWidget>
+
+QT_BEGIN_NAMESPACE
+
+class Ui_ProfilesWindow
+{
+public:
+    QAction *actionRoutingEnabled;
+    QAction *actionRouteOnDefault;
+    QWidget *centralwidget;
+    QWidget *layoutWidget;
+    QVBoxLayout *verticalLayout;
+    QHBoxLayout *horizontalLayout;
+    QPushButton *addButton;
+    QSpacerItem *horizontalSpacer1;
+    QPushButton *editButton;
+    QSpacerItem *horizontalSpacer2;
+    QPushButton *removeButton;
+    QSpacerItem *verticalSpacer;
+    QListWidget *profilesListWidget;
+    QMenuBar *menubar;
+    QMenu *menuVicarProfiles;
+
+    void setupUi(QMainWindow *ProfilesWindow)
+    {
+        if (ProfilesWindow->objectName().isEmpty())
+            ProfilesWindow->setObjectName(QString::fromUtf8("ProfilesWindow"));
+        ProfilesWindow->resize(800, 480);
+        actionRoutingEnabled = new QAction(ProfilesWindow);
+        actionRoutingEnabled->setObjectName(QString::fromUtf8("actionRoutingEnabled"));
+        actionRoutingEnabled->setCheckable(true);
+        actionRouteOnDefault = new QAction(ProfilesWindow);
+        actionRouteOnDefault->setObjectName(QString::fromUtf8("actionRouteOnDefault"));
+        actionRouteOnDefault->setCheckable(true);
+        centralwidget = new QWidget(ProfilesWindow);
+        centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
+        layoutWidget = new QWidget(centralwidget);
+        layoutWidget->setObjectName(QString::fromUtf8("layoutWidget"));
+        layoutWidget->setGeometry(QRect(31, 11, 741, 411));
+        verticalLayout = new QVBoxLayout(layoutWidget);
+        verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
+        verticalLayout->setContentsMargins(0, 0, 0, 0);
+        horizontalLayout = new QHBoxLayout();
+        horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
+        addButton = new QPushButton(layoutWidget);
+        addButton->setObjectName(QString::fromUtf8("addButton"));
+
+        horizontalLayout->addWidget(addButton);
+
+        horizontalSpacer1 = new QSpacerItem(58, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+
+        horizontalLayout->addItem(horizontalSpacer1);
+
+        editButton = new QPushButton(layoutWidget);
+        editButton->setObjectName(QString::fromUtf8("editButton"));
+
+        horizontalLayout->addWidget(editButton);
+
+        horizontalSpacer2 = new QSpacerItem(58, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
+
+        horizontalLayout->addItem(horizontalSpacer2);
+
+        removeButton = new QPushButton(layoutWidget);
+        removeButton->setObjectName(QString::fromUtf8("removeButton"));
+
+        horizontalLayout->addWidget(removeButton);
+
+
+        verticalLayout->addLayout(horizontalLayout);
+
+        verticalSpacer = new QSpacerItem(20, 10, QSizePolicy::Minimum, QSizePolicy::Fixed);
+
+        verticalLayout->addItem(verticalSpacer);
+
+        profilesListWidget = new QListWidget(layoutWidget);
+        profilesListWidget->setObjectName(QString::fromUtf8("profilesListWidget"));
+        profilesListWidget->setAlternatingRowColors(true);
+
+        verticalLayout->addWidget(profilesListWidget);
+
+        ProfilesWindow->setCentralWidget(centralwidget);
+        menubar = new QMenuBar(ProfilesWindow);
+        menubar->setObjectName(QString::fromUtf8("menubar"));
+        menubar->setGeometry(QRect(0, 0, 800, 23));
+        menuVicarProfiles = new QMenu(menubar);
+        menuVicarProfiles->setObjectName(QString::fromUtf8("menuVicarProfiles"));
+        ProfilesWindow->setMenuBar(menubar);
+
+        menubar->addAction(menuVicarProfiles->menuAction());
+        menuVicarProfiles->addAction(actionRoutingEnabled);
+        menuVicarProfiles->addAction(actionRouteOnDefault);
+
+        retranslateUi(ProfilesWindow);
+
+        QMetaObject::connectSlotsByName(ProfilesWindow);
+    } // setupUi
+
+    void retranslateUi(QMainWindow *ProfilesWindow)
+    {
+        ProfilesWindow->setWindowTitle(QApplication::translate("ProfilesWindow", "VICaR - Profiles", 0, QApplication::UnicodeUTF8));
+        actionRoutingEnabled->setText(QApplication::translate("ProfilesWindow", "Routing Enabled", 0, QApplication::UnicodeUTF8));
+#ifndef QT_NO_TOOLTIP
+        actionRoutingEnabled->setToolTip(QApplication::translate("ProfilesWindow", "Call Routing Enabled?", 0, QApplication::UnicodeUTF8));
+#endif // QT_NO_TOOLTIP
+        actionRouteOnDefault->setText(QApplication::translate("ProfilesWindow", "Call Directly on Default", 0, QApplication::UnicodeUTF8));
+#ifndef QT_NO_TOOLTIP
+        actionRouteOnDefault->setToolTip(QApplication::translate("ProfilesWindow", "Call directly if no match found?", 0, QApplication::UnicodeUTF8));
+#endif // QT_NO_TOOLTIP
+        addButton->setText(QApplication::translate("ProfilesWindow", "Add", 0, QApplication::UnicodeUTF8));
+        editButton->setText(QApplication::translate("ProfilesWindow", "Edit", 0, QApplication::UnicodeUTF8));
+        removeButton->setText(QApplication::translate("ProfilesWindow", "Remove", 0, QApplication::UnicodeUTF8));
+        menuVicarProfiles->setTitle(QApplication::translate("ProfilesWindow", "VICaR - Profiles", 0, QApplication::UnicodeUTF8));
+    } // retranslateUi
+
+};
+
+namespace Ui {
+    class ProfilesWindow: public Ui_ProfilesWindow {};
+} // namespace Ui
+
+QT_END_NAMESPACE
+
+#endif // UI_PROFILESWINDOW_H
old mode 100644 (file)
new mode 100755 (executable)
index bd8d89c..640b2a3
@@ -7,7 +7,7 @@ LIBS += /usr/lib/libgconf-2.so
 LIBS += ../lib/libvicar.a
 CONFIG += qt \
     debug
-QT += dbus
+QT += dbus sql
 TEMPLATE = app
 TARGET = vicar-config
 VPATH += src \
@@ -17,10 +17,13 @@ MOC_DIR = mocs
 OBJECTS_DIR = objs
 
 # Input
-HEADERS += configwindow.h
-FORMS += configwindow.ui
-SOURCES += src/main.cpp \
-    configwindow.cpp
+HEADERS += profileswindow.h \
+    profilesettingsdialog.h
+FORMS += profileswindow.ui \
+    profilesettingsdialog.ui
+SOURCES += main.cpp \
+    profileswindow.cpp \
+    profilesettingsdialog.cpp
 
 # MAKE INSTALL
 INSTALLDIR = /../../debian/vicar
old mode 100644 (file)
new mode 100755 (executable)
index e6155f5..9313b2f
 /*
-@version: 0.2
-@author: Sudheer K. <scifi.guy@hotmail.com>
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
 @license: GNU General Public License
 */
 
 #include "callrouter.h"
+#include "vicardbusadaptor.h"
 #include <dbusutility.h>
 #include <gconfutility.h>
+#include <databaseutility.h>
+#include <telepathyutility.h>
 #include <QDebug>
 #include <QRegExp>
 #include <QDBusConnection>
-#include <QTimer>
+#include <QDBusMessage>
 #include <QStringListIterator>
 
-//Create a statis Dbus utility object that will be shared across all member functions
-static DbusUtility dbusUtility = DbusUtility();
-static QString strLastDialedNumber = QString();
+
+//static QString strLastDialedNumber = QString();
+//static org::maemo::vicar::Profile currentProfile;
+
+class CallRouterPrivate
+{
+public:
+    CallRouterPrivate(CallRouter * p) :
+        databaseUtility(new DatabaseUtility(p)),
+        dbusAdaptor(new VicarDbusAdaptor(p)),
+        dbusUtility(new DbusUtility(p)),        
+        gconfUtility(new GConfUtility(p)),
+        tpUtility(new TelepathyUtility(p)),
+        parent(p)
+    {
+        Q_ASSERT(0 != dbusAdaptor);
+        //Do not open here - Unable to capture changes to DB if it is open too early and closed late.
+        //databaseUtility->openDatabase();
+    }
+
+    ~CallRouterPrivate()
+    {
+        qDebug() << "VICaR: Call Router Destructing";
+        //databaseUtility->closeDatabase();
+    }
+
+    DatabaseUtility *databaseUtility;
+    VicarDbusAdaptor * dbusAdaptor;
+    DbusUtility * dbusUtility;
+    GConfUtility * gconfUtility;
+    TelepathyUtility *tpUtility;
+    QString strLastDialedNumber;
+    org::maemo::vicar::Profile *currentProfile;
+    CallRouter * const parent;
+};
+
+// ---------------------------------------------------------------------------
 
 CallRouter::CallRouter(QObject *parent) :
-    QObject(parent)
+    QObject(parent),
+    d(new CallRouterPrivate(this))
 {
-        gconfUtility = new GConfUtility();
+        Q_ASSERT(0 != d);
+        this->registerDBusService();
+        qDebug() << "Registered DBus Service " << APPLICATION_DBUS_SERVICE;
 }
 
 CallRouter::~CallRouter(){
-        delete gconfUtility;
-        gconfUtility = 0;
 }
 
 void CallRouter::registerDBusService(){
-    QDBusConnection connection = dbusUtility.getConnection();
+    //Connect to Session Bus
+    QDBusConnection connection = d->dbusUtility->getConnection(false);
+
+    if (!connection.interface()->isServiceRegistered(APPLICATION_DBUS_SERVICE)){
 
-    if (!connection.registerService(APPLICATION_DBUS_SERVICE)) {
-        qDebug() << dbusUtility.getErrorMessage();
-        exit(1);
+        if (!connection.registerService(APPLICATION_DBUS_SERVICE)) {
+            qDebug() << d->dbusUtility->getErrorMessage();
+            exit(1);
+        }
     }
 
-    if (!connection.registerObject(APPLICATION_DBUS_PATH, this,
-            QDBusConnection::ExportScriptableSlots)) {
-        qDebug() << dbusUtility.getErrorMessage();
+    if (!connection.registerObject(APPLICATION_DBUS_PATH, this, QDBusConnection::ExportAdaptors)) {
+        qDebug() << d->dbusUtility->getErrorMessage();
         exit(2);
     }
 
-    this->connectToDBusSignals();
-
 }
 
 
 void CallRouter::unregisterDBusService(){
 
-    this->disconnectFromDBusSignals();
-
-    QDBusConnection connection = dbusUtility.getConnection();
+    //Disconnect from Session bus
+    QDBusConnection connection = d->dbusUtility->getConnection(false);
 
     connection.unregisterObject(APPLICATION_DBUS_PATH,QDBusConnection::UnregisterTree);
 
     if (!connection.unregisterService(APPLICATION_DBUS_SERVICE)) {
-        qDebug() << dbusUtility.getErrorMessage();
+        qDebug() << d->dbusUtility->getErrorMessage();
         exit(3);
     }
 
 }
 
-void CallRouter::connectToDBusSignals(){
+QString CallRouter::callViaCallingCard(QString strDestinationNumber){
 
-    QDBusConnection connection = dbusUtility.getConnection();
+        d->currentProfile = new org::maemo::vicar::Profile();
+        d->currentProfile->profileID = 0;
 
-    // Connect to the signal to enable call routing
-    bool success = connection.connect(QString(""),QString(""),
-                       APPLICATION_DBUS_INTERFACE,
-                       QString("startOutgoingCallMonitor"),this,
-                       SLOT(startOutgoingCallMonitor()));
-
-    if (success){
-        qDebug() << "Successfully connected to Dbus signal org.maemo.vicar.startOutgoingCallMonitor";
-    }
-    else{
-        qDebug() << "Failed to connect to Dbus signal org.maemo.vicar.startOutgoingCallMonitor";
-        qDebug() <<"DBus Error: "<< qPrintable(dbusUtility.getErrorMessage());
-    }
-
-    // Connect to the signal to disable call routing
-    success = connection.connect(QString(""),QString(""),
-                       APPLICATION_DBUS_INTERFACE,
-                       QString("stopOutgoingCallMonitor"),this,
-                       SLOT(stopOutgoingCallMonitor()));
-
-    if (success){
-        qDebug() << "Successfully connected to Dbus signal org.maemo.vicar.stopOutgoingCallMonitor";
-    }
-    else{
-        qDebug() << "Failed to connect to Dbus signal org.maemo.vicar.stopOutgoingCallMonitor";
-        qDebug() <<"DBus Error: "<< qPrintable(dbusUtility.getErrorMessage());
-    }
-
-}
+        d->databaseUtility->openDatabase();
+        bool result = d->databaseUtility->findProfileByNumber(strDestinationNumber,d->currentProfile);
 
-void CallRouter::disconnectFromDBusSignals(){
-
-    QDBusConnection connection = dbusUtility.getConnection();
-
-    // Disconnect from the signal to enable call routing
-    bool success = connection.disconnect(QString(""),QString(""),
-                       APPLICATION_DBUS_INTERFACE,
-                       QString("startOutgoingCallMonitor"),this,
-                       SLOT(startOutgoingCallMonitor()));
-
-    if (success){
-        qDebug() << "Successfully disconnected from Dbus signal org.maemo.vicar.startOutgoingCallMonitor";
-    }
-    else{
-        qDebug() << "Failed to disconnect from Dbus signal org.maemo.vicar.startOutgoingCallMonitor";
-        qDebug() <<"DBus Error: "<< qPrintable(dbusUtility.getErrorMessage());
-    }
-
-    // Disconnect from the signal to disable call routing
-    success = connection.connect(QString(""),QString(""),
-                       APPLICATION_DBUS_INTERFACE,
-                       QString("stopOutgoingCallMonitor"),this,
-                       SLOT(stopOutgoingCallMonitor()));
-
-    if (success){
-        qDebug() << "Successfully disconnected from Dbus signal org.maemo.vicar.stopOutgoingCallMonitor";
-    }
-    else{
-        qDebug() << "Failed to disconnect from Dbus signal org.maemo.vicar.stopOutgoingCallMonitor";
-        qDebug() <<"DBus Error: "<< qPrintable(dbusUtility.getErrorMessage());
-    }
-
-}
-
-void CallRouter::startOutgoingCallMonitor(){
-
-    // Connect to DBus to monitor all outgoing calls
-
-    QDBusConnection connection = dbusUtility.getConnection();
-
-
-    // Declare the slot to be executed when new calls are placed
-
-    bool success = connection.connect(QString(""),
-                       CSD_CALL_PATH,
-                       CSD_CALL_INTERFACE,
-                       QString("CreateRequested"),this,
-                       SLOT(processOutgoingCall(const QDBusMessage&)));
-
-    if (success){
-        qDebug() << "Successfully connected to Dbus signal CreateRequested in interface "<< CSD_CALL_INTERFACE;
-    }
-    else{
-        qDebug() << "Failed to connect to Dbus signal CreateRequested in interface " << CSD_CALL_INTERFACE;
-        qDebug() <<"DBus Error: "<< dbusUtility.getErrorMessage();
-    }
-
-
-}
-
-void CallRouter::stopOutgoingCallMonitor(){
-
-    this->stopCallStatusMonitors();
-
-    //Disconnect the slots from Dbus signals
-    QDBusConnection connection = dbusUtility.getConnection();
-
-    // Disconnect the slot for new calls
-    bool status = connection.disconnect(QString(""),
-                                           CSD_CALL_PATH,
-                                           CSD_CALL_INTERFACE,
-                                           QString("CreateRequested"),this,
-                                           SLOT(processOutgoingCall(const QDBusMessage&)));
-
-    if (status){
-        qDebug() << "Successfully disconnected from Dbus signal CreateRequested in interface "<< CSD_CALL_INTERFACE;
-    }
-    else{
-        qDebug() << "Failed to disconnect from Dbus signal CreateRequested in interface "<< CSD_CALL_INTERFACE;
-        qDebug() <<"DBus Error: "<< dbusUtility.getErrorMessage();
-    }
-
-}
-
-void CallRouter::processOutgoingCall(const QDBusMessage& dbusMessage){
-
-    //Verify Whether Call Routing is Enabled
-    bool isRoutingEnabled = gconfUtility->getGconfValueBoolean("routing_enabled");
-
-    if (isRoutingEnabled){
-        //User is making a phone call. Get the phone number and verify if it is an international number
-        QList<QVariant> listArguments = dbusMessage.arguments();
-        QString strInternationalNumber =  listArguments.first().toString();
-
-        qDebug() << "New Call Identified. Destination number is " << strInternationalNumber;
-
-         if (strInternationalNumber.startsWith("+") ||
-             strInternationalNumber.startsWith("00"))
-         {
-             qDebug() << "International number "<< strInternationalNumber << " recognized. Starting proceedings..";
-
-             //Check whether this is one of the excluded country codes
-             if (!isExcludedNumber(strInternationalNumber)){
-
-                //International number. Disconnect the current call (A new call will be placed)
-
-                //No arguments required to cancel the current call
-                QList<QVariant> argsToSend;
-                bool status = dbusUtility.sendMethodCall(CSD_CALL_SERVICE,
-                                                         CSD_CALL_PATH,
-                                                         CSD_CALL_INTERFACE,
-                                                         QString("Release"),argsToSend);
-
-                QString strUserMessage;
-                if (status){
-                    strUserMessage = QString("Routing international call via ").append(APPLICATION_FRIENDLY_NAME).append("..");
-                    qDebug() << strUserMessage;
-                    strLastDialedNumber = strInternationalNumber;
-                }
-                else{
-                    strUserMessage = QString("Call could not be cancelled.");
-                    qDebug() << dbusUtility.getErrorMessage();
-                }
-
-                dbusUtility.displayNotification(strUserMessage);
-
-                //Wait for a few seconds before the current call is completely disconnected
-                QTimer *timer = new QTimer(this);
-                timer->setSingleShot(true);
-                connect(timer, SIGNAL(timeout()), this, SLOT(callViaCallingCard()));
-                timer->start(3000);
-             }
+        QString strErrorMessage;
+        if (!result){
+            strErrorMessage = QString("Error finding VICaR profile. %1").arg(d->databaseUtility->lastError().text());
         }
-     }
-}
-
-void CallRouter::callViaCallingCard(){
-        //Now call the calling card number. This is generally a local and/or tollfree number
+        else if (d->currentProfile->profileID == 0){
+            bool routeOnDefault = d->gconfUtility->getGconfValueBoolean("route_on_default");
+            if (routeOnDefault){
+                qDebug() << "Routing directly as per configuration";
+               this->placeCall(strDestinationNumber);
+            }
+            else{
+                qDebug() << "No profile found. Stopping..";
+                strErrorMessage  = "VICaR: No routing profile defined for this number.";
+                d->dbusUtility->displayNotification(strErrorMessage );
+            }
+        }
+        else{
+            //Now call the calling card number. This is generally a local and/or tollfree number
+            QString strCallingCardNumber = d->currentProfile->gatewayNumber;
+            qDebug() << "Initiating call to "<< strCallingCardNumber;
+            bool status = this->placeCall(strCallingCardNumber);
+            d->strLastDialedNumber = strDestinationNumber;
 
-        QString strCallingCardNumber = gconfUtility->getGconfValueString("calling_card_number");
+            QString strUserMessage;
 
-        qDebug() << "Wait time elapsed. Initiating call to "<< strCallingCardNumber;
+            if (status){
+                qDebug() << "Call initiated successfully. Connecting DBus slot for audio connection monitor";
+                 startCallStatusMonitors();
+            }
+            else {
+                strUserMessage = QString("Unable to initiate new call to ").append(strCallingCardNumber);
+                strErrorMessage = d->dbusUtility->getErrorMessage();
+                qDebug() << strErrorMessage;
+                d->strLastDialedNumber.clear();
+                delete d->currentProfile;
+                d->currentProfile = 0;
+            }
+            d->dbusUtility->displayNotification(strUserMessage);
+        }
 
-        QList<QVariant> argsToSend;
-        argsToSend.append(strCallingCardNumber);
-        argsToSend.append(0);
+        d->databaseUtility->closeDatabase();
+        return strErrorMessage;
+}
 
-        bool status = dbusUtility.sendMethodCall(CSD_SERVICE,
-                                                 CSD_CALL_PATH,
-                                             CSD_CALL_INTERFACE,
-                                             QString("CreateWith"),argsToSend);
+bool CallRouter::placeCall(QString number){
 
-        QString strUserMessage;
-        if (status){
-            qDebug() << "Call initiated successfully. Connecting DBus slot for audio connection monitor";
-             startCallStatusMonitors();
-        }
-        else {
-            strUserMessage = QString("Unable to initiate new call to ").append(strCallingCardNumber);
-            qDebug() << dbusUtility.getErrorMessage();
-            strLastDialedNumber.clear();
-        }
+    QList<QVariant> argsToSend;
+    argsToSend.append(number);
+    argsToSend.append(0);
 
-        dbusUtility.displayNotification(strUserMessage);
+    bool status = d->dbusUtility->sendMethodCall(CSD_SERVICE,
+                                             CSD_CALL_PATH,
+                                         CSD_CALL_INTERFACE,
+                                         QString("CreateWith"),argsToSend);
+    return status;
 
 }
 
@@ -268,7 +171,7 @@ void CallRouter::startCallStatusMonitors(){
        We need this to confirm whether a call went though successfully.
     */
 
-    QDBusConnection connection = dbusUtility.getConnection();
+    QDBusConnection connection = d->dbusUtility->getConnection();
 
     bool success = connection.connect(QString(""),
                            CSD_CALL_INSTANCE_PATH,
@@ -281,7 +184,7 @@ void CallRouter::startCallStatusMonitors(){
     }
     else{
         qDebug() << "Failed to connect to Dbus signal AudioConnect in interface "<< CSD_CALL_INSTANCE_INTERFACE;
-        qDebug() <<"DBus Error: "<< dbusUtility.getErrorMessage();
+        qDebug() <<"DBus Error: "<< d->dbusUtility->getErrorMessage();
     }
 
     /* Declare the slot to be executed when the call is terminated (due to connection errors etc).
@@ -299,7 +202,7 @@ void CallRouter::startCallStatusMonitors(){
     }
     else{
         qDebug() << "Failed to connect to Dbus signal Terminated in interface "<< CSD_CALL_INSTANCE_INTERFACE;
-        qDebug() <<"DBus Error: "<< dbusUtility.getErrorMessage();
+        qDebug() <<"DBus Error: "<< d->dbusUtility->getErrorMessage();
     }
 
     /* Declare the slot to be executed when a call is received
@@ -322,15 +225,17 @@ void CallRouter::startCallStatusMonitors(){
     }
     else{
         qDebug() << "Failed to connect to Dbus signal Coming in interface" << CSD_CALL_INTERFACE;
-        qDebug() <<"DBus Error: "<< dbusUtility.getErrorMessage();
+        qDebug() <<"DBus Error: "<< d->dbusUtility->getErrorMessage();
     }
 }
 
 void CallRouter::stopCallStatusMonitors(){
 
-    strLastDialedNumber.clear();
+    d->strLastDialedNumber.clear();
+    delete d->currentProfile;
+    d->currentProfile = 0;
 
-    QDBusConnection connection = dbusUtility.getConnection();
+    QDBusConnection connection = d->dbusUtility->getConnection();
 
     // Disconnect the slot for audio connection status
     bool status = connection.disconnect(QString(""),
@@ -344,7 +249,7 @@ void CallRouter::stopCallStatusMonitors(){
     }
     else{
         qDebug() << "Failed to disconnect from Dbus signal AudioConnect in interface "<< CSD_CALL_INSTANCE_INTERFACE;
-        qDebug() <<"DBus Error: "<< dbusUtility.getErrorMessage();
+        qDebug() <<"DBus Error: "<< d->dbusUtility->getErrorMessage();
     }
 
     // Disconnect the slot for monitoring terminated calls
@@ -359,7 +264,7 @@ void CallRouter::stopCallStatusMonitors(){
     }
     else{
         qDebug() << "Failed to disconnect from Dbus signal Terminated in interface "<< CSD_CALL_INSTANCE_INTERFACE;
-        qDebug() <<"DBus Error: "<< dbusUtility.getErrorMessage();
+        qDebug() <<"DBus Error: "<< d->dbusUtility->getErrorMessage();
     }
 
     // Disconnect the slot for monitoring incoming calls
@@ -374,13 +279,13 @@ void CallRouter::stopCallStatusMonitors(){
     }
     else{
         qDebug() << "Failed to disconnect from Dbus signal Coming in interface" << CSD_CALL_INTERFACE;
-        qDebug() <<"DBus Error: "<< dbusUtility.getErrorMessage();
+        qDebug() <<"DBus Error: "<< d->dbusUtility->getErrorMessage();
     }
 }
 
 void CallRouter::sendNumberAsDTMFCode(const QDBusMessage& dbusMessage){
 
-    if (!strLastDialedNumber.isEmpty()){
+    if (!d->strLastDialedNumber.isEmpty() && d->currentProfile != 0){
         //Verify whether we have the last dialed number available
 
         QList<QVariant> listArguments = dbusMessage.arguments();
@@ -388,14 +293,14 @@ void CallRouter::sendNumberAsDTMFCode(const QDBusMessage& dbusMessage){
 
         if (audioConnected){
             // Now that the call to Calling card number is successful. We can send the original number as DTMF tones
-            QString strDTMFCode = convertToDTMFCode(strLastDialedNumber);
+            QString strDTMFCode = convertToDTMFCode(d->strLastDialedNumber);
 
             qDebug() << "Audio connection established. Sending DTMF code "<< strDTMFCode;
 
             QList<QVariant> argsToSend;
             argsToSend.append(strDTMFCode);
 
-            bool status = dbusUtility.sendMethodCall(CSD_SERVICE,
+            bool status = d->dbusUtility->sendMethodCall(CSD_SERVICE,
                                                      CSD_CALL_PATH,
                                                  CSD_CALL_INTERFACE,
                                                  QString("SendDTMF"),argsToSend);
@@ -403,7 +308,7 @@ void CallRouter::sendNumberAsDTMFCode(const QDBusMessage& dbusMessage){
             if (status){
                 QString strMessage = strDTMFCode.append(" sent as DTMF code");
                 qDebug() << strMessage;
-                dbusUtility.displayNotification(strMessage);
+                d->dbusUtility->displayNotification(strMessage);
             }
             else{
                 qDebug() << "Unable to send DTMF code.";
@@ -419,6 +324,9 @@ void CallRouter::sendNumberAsDTMFCode(const QDBusMessage& dbusMessage){
             qDebug() << "Now disconnecting from call status monitors..";
             stopCallStatusMonitors();
 
+            d->strLastDialedNumber.clear();
+            delete d->currentProfile;
+            d->currentProfile = 0;
         }
         else{
             qDebug() << "Audio not yet connected.";
@@ -434,16 +342,21 @@ QString CallRouter::convertToDTMFCode(QString strNumber){
     QString strDTMFCode;
 
     if (!strNumber.isEmpty()){
+        int intDTMFDelay = 1;
 
-        //Get the format required by calling card from coniguration
-        QString qstrDTMFFormat = gconfUtility->getGconfValueString("dtmf_format");
-        int intDTMFDelay = gconfUtility->getGconfValueInteger("dtmf_delay");
+        //Add the prefix p so that there is some delay after the call is picked up by the automated system to send DTMF tones.
+        strDTMFCode = QString("").fill('p',intDTMFDelay);        
 
-        if (intDTMFDelay <1 ) intDTMFDelay = 1;
-        if (qstrDTMFFormat.isEmpty()) qstrDTMFFormat = "<Country Code><Area Code><Phone Number>";
+        //Now check whether we need a prefix
+        QString strDTMFPrefix = d->currentProfile->dtmfPrefix;
 
-        //Add the prefix p so that there is some delay after the call is picked up by the automated system to send DTMF tones.
-        strDTMFCode = QString("").fill('p',intDTMFDelay);
+        if (!strDTMFPrefix.isEmpty()){
+            strDTMFCode = strDTMFCode.append(strDTMFPrefix);
+        }
+
+        //Get the format required by calling card from coniguration
+        QString qstrDTMFFormat = d->currentProfile->dtmfFormat;
+        if (qstrDTMFFormat.isEmpty()) qstrDTMFFormat = "<Country Code><Area Code><Phone Number>";
 
         /* Replace 00 (international dialing code) at the beginning
            and also replace any character other than the numbers 0-9 and p.
@@ -463,13 +376,12 @@ QString CallRouter::convertToDTMFCode(QString strNumber){
         else if (qstrDTMFFormat.startsWith("011")){
             strDTMFCode = strDTMFCode.append("011");
         }
-        //Default case - we don't need any prefix
 
         strDTMFCode = strDTMFCode.append(strNumber);
 
         //Now check whether we need a suffix
-        QString strDTMFSuffix = gconfUtility->getGconfValueString("dtmf_suffix");
-        if (!strDTMFSuffix.isEmpty() && !strDTMFSuffix.contains("--None--")){
+        QString strDTMFSuffix = d->currentProfile->dtmfSuffix;
+        if (!strDTMFSuffix.isEmpty()){
             strDTMFCode = strDTMFCode.append(strDTMFSuffix);
         }
     }
@@ -477,24 +389,33 @@ QString CallRouter::convertToDTMFCode(QString strNumber){
     return strDTMFCode;
 }
 
-bool CallRouter::isExcludedNumber(QString strInternationalNumber){
+//DBus Method used by external applications to check whether VICaR is enabled and running
+bool CallRouter::isRunning(){
 
-    bool isExcluded = false;
+    return true;
 
-    //Get the list of excluded codes
-    QString qstrExcludedNumbers = gconfUtility->getGconfValueString("numbers_to_exclude");
-    QStringList strExcludedCodeList = qstrExcludedNumbers.split(",");
-    QStringListIterator iterator(strExcludedCodeList);
+    //Verify Whether VICaR telepathy account is online
+    /*
+    if (d->tpUtility->getAccountStatus() == "Connected"){
+        return true;
+    }
+    else{
+        return false;
+    }
+    */
+}
 
-    QRegExp regexp = QRegExp("(^0{2})|[^0-9p]");
+//DBus Method used by external applications to call via VICaR
+QString CallRouter::callInternationalNumber(const QString& strDestinationNumber){
 
-    while (iterator.hasNext()){
-        QString strCode = iterator.next();
-        strCode = strCode.replace(regexp,"");
-        strInternationalNumber = strInternationalNumber.replace(regexp,"");
-        if (!strCode.isEmpty() && strInternationalNumber.startsWith(strCode)){
-            isExcluded = true;
-        }
+    qDebug() << "New call requested by external application. Destination number is " << strDestinationNumber;
+    QString strErrorMessage = this->callViaCallingCard(strDestinationNumber);
+    qDebug() << strErrorMessage;
+
+    if (strErrorMessage.isEmpty()){
+        return QString("Success");
     }
-    return isExcluded;
-}
+    else{
+        return strErrorMessage;
+    }
+ }
old mode 100644 (file)
new mode 100755 (executable)
index 44c2ed9..e6e994e
@@ -1,6 +1,6 @@
 /*
-@version: 0.2
-@author: Sudheer K. <scifi.guy@hotmail.com>
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
 @license: GNU General Public License
 */
 
@@ -9,7 +9,9 @@
 
 #include <QObject>
 #include <QDBusMessage>
+#include <dbusutility.h>
 #include <gconfutility.h>
+#include "vicardbusadaptor.h"
 
 #define APPLICATION_DBUS_PATH "/org/maemo/vicar"
 #define APPLICATION_DBUS_INTERFACE "org.maemo.vicar"
@@ -26,6 +28,8 @@
 #define CSD_CALL_SERVICE       "com.nokia.csd.Call"
 #define CSD_SERVICE             "com.nokia.csd"
 
+class CallRouterPrivate;
+
 class CallRouter : public QObject
 {
 Q_OBJECT
@@ -37,24 +41,24 @@ public:
     void registerDBusService();
     void unregisterDBusService();
 
+protected:
     void startCallStatusMonitors();
     QString convertToDTMFCode(QString);
-    void connectToDBusSignals();
-    void disconnectFromDBusSignals();
     bool isExcludedNumber(QString);
+    bool placeCall(QString);
 
-public slots:
-    Q_SCRIPTABLE void startOutgoingCallMonitor();
-    Q_SCRIPTABLE void stopOutgoingCallMonitor();
-    Q_SCRIPTABLE void processOutgoingCall(const QDBusMessage& dbusMessage);
-    Q_SCRIPTABLE void callViaCallingCard();
-    Q_SCRIPTABLE void sendNumberAsDTMFCode(const QDBusMessage& dbusMessage);
-    Q_SCRIPTABLE void stopCallStatusMonitors();
-
+protected slots:
+    QString callViaCallingCard(QString);
+    void sendNumberAsDTMFCode(const QDBusMessage& dbusMessage);
+    void stopCallStatusMonitors();
 
+    //D-Bus Interface Methods
+public slots:
+    bool isRunning();
+    QString callInternationalNumber(const QString& internationalNumber);
 
 private:
-    GConfUtility *gconfUtility;
+    CallRouterPrivate * const d;
 };
 
 #endif // CALLROUTER_H
old mode 100644 (file)
new mode 100755 (executable)
index 53b074c..1874fbd
@@ -1,6 +1,6 @@
 /*
-@version: 0.2
-@author: Sudheer K. <scifi.guy@hotmail.com>
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
 @license: GNU General Public License
 */
 
@@ -8,26 +8,14 @@
 #include <QDBusConnection>
 #include <QDebug>
 #include "callrouter.h"
-#include "gconfutility.h"
+//#include "vicarprofiletypes.h"
 
 int main(int argc, char *argv[])
 {
-    QCoreApplication a(argc, argv);
+    //qDBusRegisterMetaType<org::maemo::vicar::Profile>();
+    //qDBusRegisterMetaType<org::maemo::vicar::ProfileList>();
 
+    QCoreApplication a(argc, argv);
     CallRouter callRouter(&a);
-    callRouter.registerDBusService();
-    qDebug() << "Registered DBus Service " << APPLICATION_DBUS_SERVICE;
-
-    GConfUtility *gconfUtility = new GConfUtility();
-    //If International call routing is already enabled, start monitoring calls
-    //Otherwise wait for the signal from the configuration app
-    if (gconfUtility->getGconfValueBoolean((char *)"routing_enabled")){
-        qDebug() << "Call routing enabled. Starting call monitor..";
-        callRouter.startOutgoingCallMonitor();
-    }
-
-    delete gconfUtility;
-    gconfUtility = 0;
-
     return a.exec();          
 }
diff --git a/src/vicar-daemon/src/vicardbusadaptor.cpp b/src/vicar-daemon/src/vicardbusadaptor.cpp
new file mode 100755 (executable)
index 0000000..5f387ca
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -c VicarDbusAdaptor -a vicardbusadaptor.h:vicardbusadaptor.cpp org.maemo.vicar.xml
+ *
+ * qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#include "vicardbusadaptor.h"
+#include <QtCore/QMetaObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+
+/*
+ * Implementation of adaptor class VicarDbusAdaptor
+ */
+
+VicarDbusAdaptor::VicarDbusAdaptor(QObject *parent)
+    : QDBusAbstractAdaptor(parent)
+{
+    // constructor
+    setAutoRelaySignals(true);
+}
+
+VicarDbusAdaptor::~VicarDbusAdaptor()
+{
+    // destructor
+}
+
+QString VicarDbusAdaptor::callInternationalNumber(const QString &number)
+{
+    // handle method call org.maemo.vicar.callInternationalNumber
+    QString out0;
+    QMetaObject::invokeMethod(parent(), "callInternationalNumber", Q_RETURN_ARG(QString, out0), Q_ARG(QString, number));
+    return out0;
+}
+
+bool VicarDbusAdaptor::isRunning()
+{
+    // handle method call org.maemo.vicar.isRunning
+    bool out0;
+    QMetaObject::invokeMethod(parent(), "isRunning", Q_RETURN_ARG(bool, out0));
+    return out0;
+}
+
+bool VicarDbusAdaptor::startOutgoingCallMonitor()
+{
+    // handle method call org.maemo.vicar.startOutgoingCallMonitor
+    bool out0;
+    QMetaObject::invokeMethod(parent(), "startOutgoingCallMonitor", Q_RETURN_ARG(bool, out0));
+    return out0;
+}
+
+bool VicarDbusAdaptor::stopOutgoingCallMonitor()
+{
+    // handle method call org.maemo.vicar.stopOutgoingCallMonitor
+    bool out0;
+    QMetaObject::invokeMethod(parent(), "stopOutgoingCallMonitor", Q_RETURN_ARG(bool, out0));
+    return out0;
+}
+
diff --git a/src/vicar-daemon/src/vicardbusadaptor.h b/src/vicar-daemon/src/vicardbusadaptor.h
new file mode 100755 (executable)
index 0000000..85256f2
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -c VicarDbusAdaptor -a vicardbusadaptor.h:vicardbusadaptor.cpp org.maemo.vicar.xml
+ *
+ * qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#ifndef VICARDBUSADAPTOR_H_1278741980
+#define VICARDBUSADAPTOR_H_1278741980
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+class QByteArray;
+template<class T> class QList;
+template<class Key, class Value> class QMap;
+class QString;
+class QStringList;
+class QVariant;
+
+/*
+ * Adaptor class for interface org.maemo.vicar
+ */
+class VicarDbusAdaptor: public QDBusAbstractAdaptor
+{
+    Q_OBJECT
+    Q_CLASSINFO("D-Bus Interface", "org.maemo.vicar")
+    Q_CLASSINFO("D-Bus Introspection", ""
+"  <interface name=\"org.maemo.vicar\">\n"
+"    <method name=\"startOutgoingCallMonitor\">\n"
+"      <arg direction=\"out\" type=\"b\"/>\n"
+"    </method>\n"
+"    <method name=\"stopOutgoingCallMonitor\">\n"
+"      <arg direction=\"out\" type=\"b\"/>\n"
+"    </method>\n"
+"    <method name=\"isRunning\">\n"
+"      <arg direction=\"out\" type=\"b\"/>\n"
+"    </method>\n"
+"    <method name=\"callInternationalNumber\">\n"
+"      <arg direction=\"in\" type=\"s\" name=\"number\"/>\n"
+"      <arg direction=\"out\" type=\"s\"/>\n"
+"    </method>\n"
+"  </interface>\n"
+        "")
+public:
+    VicarDbusAdaptor(QObject *parent);
+    virtual ~VicarDbusAdaptor();
+
+public: // PROPERTIES
+public Q_SLOTS: // METHODS
+    QString callInternationalNumber(const QString &number);
+    bool isRunning();
+    bool startOutgoingCallMonitor();
+    bool stopOutgoingCallMonitor();
+Q_SIGNALS: // SIGNALS
+};
+
+#endif
old mode 100644 (file)
new mode 100755 (executable)
index f4c6e78..0984e63
@@ -7,7 +7,7 @@ LIBS += /usr/lib/libgconf-2.so
 LIBS += ../lib/libvicar.a
 
 CONFIG += qt debug
-QT += dbus
+QT += dbus sql
 QT -= gui
 TEMPLATE = app
 TARGET = vicar-daemon
@@ -19,8 +19,10 @@ MOC_DIR = mocs
 OBJECTS_DIR = objs
 
 SOURCES += src/main.cpp \
-    src/callrouter.cpp
-HEADERS += src/callrouter.h
+    src/callrouter.cpp \
+    src/vicardbusadaptor.cpp
+HEADERS += src/callrouter.h \
+           src/vicardbusadaptor.h
 
 #MAKE INSTALL
 INSTALLDIR = /../../debian/vicar
diff --git a/src/vicar-lib/src/accountcompatproxy.cpp b/src/vicar-lib/src/accountcompatproxy.cpp
new file mode 100644 (file)
index 0000000..97ffd81
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -c AccountCompatProxy -p accountcompatproxy.h:accountcompatproxy.cpp org.freedesktop.Telepathy.Account.xml com.nokia.Account.Interface.Compat
+ *
+ * qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#include "accountcompatproxy.h"
+
+/*
+ * Implementation of interface class AccountCompatProxy
+ */
+
+AccountCompatProxy::AccountCompatProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
+    : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
+{
+}
+
+AccountCompatProxy::~AccountCompatProxy()
+{
+}
+
diff --git a/src/vicar-lib/src/accountcompatproxy.h b/src/vicar-lib/src/accountcompatproxy.h
new file mode 100644 (file)
index 0000000..024eba6
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -c AccountCompatProxy -p accountcompatproxy.h:accountcompatproxy.cpp org.freedesktop.Telepathy.Account.xml com.nokia.Account.Interface.Compat
+ *
+ * qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#ifndef ACCOUNTCOMPATPROXY_H_1281150160
+#define ACCOUNTCOMPATPROXY_H_1281150160
+
+#include <QtCore/QObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+#include <QtDBus/QtDBus>
+
+/*
+ * Proxy class for interface com.nokia.Account.Interface.Compat
+ */
+class AccountCompatProxy: public QDBusAbstractInterface
+{
+    Q_OBJECT
+public:
+    static inline const char *staticInterfaceName()
+    { return "com.nokia.Account.Interface.Compat"; }
+
+public:
+    AccountCompatProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
+
+    ~AccountCompatProxy();
+
+public Q_SLOTS: // METHODS
+    inline QDBusPendingReply<> SetHasBeenOnline()
+    {
+        QList<QVariant> argumentList;
+        return asyncCallWithArgumentList(QLatin1String("SetHasBeenOnline"), argumentList);
+    }
+
+Q_SIGNALS: // SIGNALS
+    void CompatPropertyChanged(const QVariantMap &in0);
+};
+
+namespace com {
+  namespace nokia {
+    namespace Account {
+      namespace Interface {
+        typedef ::AccountCompatProxy Compat;
+      }
+    }
+  }
+}
+#endif
diff --git a/src/vicar-lib/src/accountmanagerproxy.cpp b/src/vicar-lib/src/accountmanagerproxy.cpp
new file mode 100644 (file)
index 0000000..bdb9ac2
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -c AccountManagerProxy -p accountmanagerproxy.h:accountmanagerproxy.cpp org.freedesktop.Telepathy.AccountManager.xml org.freedesktop.Telepathy.AccountManager
+ *
+ * qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#include "accountmanagerproxy.h"
+
+/*
+ * Implementation of interface class AccountManagerProxy
+ */
+
+AccountManagerProxy::AccountManagerProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
+    : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
+{
+}
+
+AccountManagerProxy::~AccountManagerProxy()
+{
+}
+
diff --git a/src/vicar-lib/src/accountmanagerproxy.h b/src/vicar-lib/src/accountmanagerproxy.h
new file mode 100644 (file)
index 0000000..10a97b9
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -c AccountManagerProxy -p accountmanagerproxy.h:accountmanagerproxy.cpp org.freedesktop.Telepathy.AccountManager.xml org.freedesktop.Telepathy.AccountManager
+ *
+ * qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#ifndef ACCOUNTMANAGERPROXY_H_1281083196
+#define ACCOUNTMANAGERPROXY_H_1281083196
+
+#include <QtCore/QObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+#include <QtDBus/QtDBus>
+
+/*
+ * Proxy class for interface org.freedesktop.Telepathy.AccountManager
+ */
+class AccountManagerProxy: public QDBusAbstractInterface
+{
+    Q_OBJECT
+public:
+    static inline const char *staticInterfaceName()
+    { return "org.freedesktop.Telepathy.AccountManager"; }
+
+public:
+    AccountManagerProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
+
+    ~AccountManagerProxy();
+
+public Q_SLOTS: // METHODS
+    inline QDBusPendingReply<QDBusObjectPath> CreateAccount(const QString &Connection_Manager, const QString &Protocol, const QString &Display_Name, const QVariantMap &Parameters, const QVariantMap &Properties)
+    {
+        QList<QVariant> argumentList;
+        argumentList << qVariantFromValue(Connection_Manager) << qVariantFromValue(Protocol) << qVariantFromValue(Display_Name) << qVariantFromValue(Parameters) << qVariantFromValue(Properties);
+        return asyncCallWithArgumentList(QLatin1String("CreateAccount"), argumentList);
+    }
+
+Q_SIGNALS: // SIGNALS
+    void AccountRemoved(const QDBusObjectPath &in0);
+    void AccountValidityChanged(const QDBusObjectPath &in0, bool in1);
+};
+
+namespace org {
+  namespace freedesktop {
+    namespace Telepathy {
+      typedef ::AccountManagerProxy AccountManager;
+    }
+  }
+}
+#endif
diff --git a/src/vicar-lib/src/accountproxy.cpp b/src/vicar-lib/src/accountproxy.cpp
new file mode 100644 (file)
index 0000000..d6a4934
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -c AccountProxy -p accountproxy.h:accountproxy.cpp org.freedesktop.Telepathy.Account.xml org.freedesktop.Telepathy.Account
+ *
+ * qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#include "accountproxy.h"
+
+/*
+ * Implementation of interface class AccountProxy
+ */
+
+AccountProxy::AccountProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
+    : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
+{
+}
+
+AccountProxy::~AccountProxy()
+{
+}
+
diff --git a/src/vicar-lib/src/accountproxy.h b/src/vicar-lib/src/accountproxy.h
new file mode 100644 (file)
index 0000000..0f97df2
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -c AccountProxy -p accountproxy.h:accountproxy.cpp org.freedesktop.Telepathy.Account.xml org.freedesktop.Telepathy.Account
+ *
+ * qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#ifndef ACCOUNTPROXY_H_1281149702
+#define ACCOUNTPROXY_H_1281149702
+
+#include <QtCore/QObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+#include <QtDBus/QtDBus>
+
+/*
+ * Proxy class for interface org.freedesktop.Telepathy.Account
+ */
+class AccountProxy: public QDBusAbstractInterface
+{
+    Q_OBJECT
+public:
+    static inline const char *staticInterfaceName()
+    { return "org.freedesktop.Telepathy.Account"; }
+
+public:
+    AccountProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
+
+    ~AccountProxy();
+
+public Q_SLOTS: // METHODS
+    inline QDBusPendingReply<> Reconnect()
+    {
+        QList<QVariant> argumentList;
+        return asyncCallWithArgumentList(QLatin1String("Reconnect"), argumentList);
+    }
+
+    inline QDBusPendingReply<> Remove()
+    {
+        QList<QVariant> argumentList;
+        return asyncCallWithArgumentList(QLatin1String("Remove"), argumentList);
+    }
+
+    inline QDBusPendingReply<QStringList> UpdateParameters(const QVariantMap &Set, const QStringList &Unset)
+    {
+        QList<QVariant> argumentList;
+        argumentList << qVariantFromValue(Set) << qVariantFromValue(Unset);
+        return asyncCallWithArgumentList(QLatin1String("UpdateParameters"), argumentList);
+    }
+
+Q_SIGNALS: // SIGNALS
+    void AccountPropertyChanged(const QVariantMap &in0);
+    void Removed();
+};
+
+namespace org {
+  namespace freedesktop {
+    namespace Telepathy {
+      typedef ::AccountProxy Account;
+    }
+  }
+}
+#endif
diff --git a/src/vicar-lib/src/databaseutility.cpp b/src/vicar-lib/src/databaseutility.cpp
new file mode 100644 (file)
index 0000000..19ffdf7
--- /dev/null
@@ -0,0 +1,182 @@
+#include "databaseutility.h"
+#include <QSqlDatabase>
+#include <QSqlError>
+#include <QSqlQuery>
+#include <QFile>
+#include <QDir>
+#include <QVariant>
+#include <QDebug>
+
+DatabaseUtility::DatabaseUtility(QObject *parent) :
+    QObject(parent)
+{
+}
+
+DatabaseUtility::~DatabaseUtility(){
+}
+
+bool DatabaseUtility::openDatabase(){
+    profilesDB = QSqlDatabase::addDatabase("QSQLITE");
+    //QString path(QDir::home().path());
+    //path.append(QDir::separator()).append("vicar.db.sqlite");
+    QString path("/home/user/vicar.db.sqlite");
+    path = QDir::toNativeSeparators(path);
+    qDebug()<< "Opening database at "<<path;
+    profilesDB.setDatabaseName(path);
+    return profilesDB.open();
+}
+
+bool DatabaseUtility::deleteDatabase(){
+    closeDatabase();
+    //QString path(QDir::home().path());
+    //path.append(QDir::separator()).append("vicar.db.sqlite");
+    QString path("/home/user/vicar.db.sqlite");
+    path = QDir::toNativeSeparators(path);
+    return QFile::remove(path);
+}
+
+void DatabaseUtility::closeDatabase(){
+    if (profilesDB.isOpen()){
+        profilesDB.close();
+    }
+}
+
+bool DatabaseUtility::tableExists(QString tableName){
+    bool exists = false;
+    if (profilesDB.isOpen()){
+        QStringList tablesList = profilesDB.tables();
+        exists = tablesList.contains(tableName,Qt::CaseInsensitive);
+    }
+    return exists;
+}
+
+bool DatabaseUtility::createProfilesTable(){
+    bool result = false;
+    if (profilesDB.isOpen()){
+        QSqlQuery query;
+        QString strQuery = "create table profiles"
+                           "(id integer primary key,"
+                           "numberpattern varchar(20),"
+                           "gatewaynumber varchar(30),"
+                           "dtmfformat varchar(100),"
+                           "dtmfprefix varchar(20),"
+                           "dtmfsuffix varchar(20)"
+                           ")";
+        result = query.exec(strQuery);
+    }
+    return result;
+}
+
+bool DatabaseUtility::selectProfile(int id,org::maemo::vicar::Profile* profile){
+    bool result = false;
+    if (profilesDB.isOpen()){
+        QString strQuery = QString("select * from profiles where id = %1").arg(id);
+        qDebug() << "SQL>"<<strQuery;
+        QSqlQuery query(strQuery);
+        if (query.next()){
+            profile->profileID = query.value(0).toInt();
+            profile->phoneNumberPattern = query.value(1).toString();
+            profile->gatewayNumber = query.value(2).toString();
+            profile->dtmfFormat = query.value(3).toString();
+            profile->dtmfPrefix = query.value(4).toString();
+            profile->dtmfSuffix = query.value(5).toString();
+            result = true;
+        }
+    }
+    return result;
+}
+
+bool DatabaseUtility::getAllProfiles(org::maemo::vicar::ProfileList* profileList){
+    bool result = false;
+    if (profilesDB.isOpen()){
+        QString strQuery = QString("select * from profiles order by id");
+        qDebug() << "SQL>"<<strQuery;
+        QSqlQuery query(strQuery);
+        while (query.next()){
+            org::maemo::vicar::Profile profile;
+            profile.profileID = query.value(0).toInt();
+            profile.phoneNumberPattern = query.value(1).toString();
+            profile.gatewayNumber = query.value(2).toString();
+            profile.dtmfFormat = query.value(3).toString();
+            profile.dtmfPrefix = query.value(4).toString();
+            profile.dtmfSuffix = query.value(5).toString();
+            profileList->append(profile);
+        }
+        result = true;
+    }
+    return result;
+}
+
+bool DatabaseUtility::findProfileByNumber(QString number,org::maemo::vicar::Profile* profile){
+    bool result = false;
+    if (profilesDB.isOpen()){
+        QString strQuery = QString("select * from profiles where '%1' like numberpattern||'%' order by length(numberpattern) desc")
+                           .arg(number);
+        qDebug() << "SQL>"<<strQuery;
+        QSqlQuery query(strQuery);
+        if (query.next()){
+            profile->profileID = query.value(0).toInt();
+            profile->phoneNumberPattern = query.value(1).toString();
+            profile->gatewayNumber = query.value(2).toString();
+            profile->dtmfFormat = query.value(3).toString();
+            profile->dtmfPrefix = query.value(4).toString();
+            profile->dtmfSuffix = query.value(5).toString();
+        }
+        result = true;
+    }
+    return result;
+}
+
+int DatabaseUtility::insertProfile(org::maemo::vicar::Profile profile){
+    int newId   = -1;
+    bool result = false;    
+    if (profilesDB.isOpen()){
+        bool continueInsert = true;
+        if (!this->tableExists()){
+            continueInsert = this->createProfilesTable();
+        }
+
+        if (continueInsert)
+        {
+            QSqlQuery query;
+            QString strQuery = QString("insert into profiles values(NULL,'%1','%2','%3','%4','%5')")
+                               .arg(profile.phoneNumberPattern).arg(profile.gatewayNumber)
+                               .arg(profile.dtmfFormat).arg(profile.dtmfPrefix).arg(profile.dtmfSuffix);
+            qDebug() << "SQL>"<<strQuery;
+            result = query.exec(strQuery);
+            if (result){
+                newId = query.lastInsertId().toInt();
+            }
+        }
+    }
+    return newId;
+}
+
+bool DatabaseUtility::updateProfile(org::maemo::vicar::Profile profile){
+    bool result = false;
+    if (profilesDB.isOpen()){
+        QSqlQuery query;
+        QString strQuery = QString("update profiles set numberpattern = '%1', "
+                                   "gatewaynumber = '%2', dtmfformat = '%3', "
+                                   "dtmfprefix = '%4', dtmfsuffix = '%5' where id = %6")
+                           .arg(profile.phoneNumberPattern).arg(profile.gatewayNumber)
+                           .arg(profile.dtmfFormat).arg(profile.dtmfPrefix)
+                           .arg(profile.dtmfSuffix).arg(profile.profileID);
+        qDebug() << "SQL>"<<strQuery;
+        result = query.exec(strQuery);
+    }
+    return result;
+}
+
+bool DatabaseUtility::deleteProfile(int id){
+    bool result = false;
+    if (profilesDB.isOpen()){
+        QSqlQuery query;
+        result = query.exec(QString("delete from profiles where id=%1").arg(id));
+    }
+    return result;
+}
+
+QSqlError DatabaseUtility::lastError(){
+    return profilesDB.lastError();
+}
diff --git a/src/vicar-lib/src/databaseutility.h b/src/vicar-lib/src/databaseutility.h
new file mode 100644 (file)
index 0000000..941ec2f
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+*/
+
+#ifndef DATABASEUTILITY_H
+#define DATABASEUTILITY_H
+
+#include <QObject>
+#include "vicarprofiletypes.h"
+#include <QSqlError>
+#include <QSqlDatabase>
+
+class DatabaseUtility : public QObject
+{
+    Q_OBJECT
+public:
+    DatabaseUtility(QObject *parent = 0);
+    ~DatabaseUtility();
+    bool openDatabase();
+    bool deleteDatabase();
+    void closeDatabase();
+    bool tableExists(QString tableName);
+    bool createProfilesTable();
+    int insertProfile(org::maemo::vicar::Profile profile);
+    bool updateProfile(org::maemo::vicar::Profile profile);
+    bool selectProfile(int id,org::maemo::vicar::Profile* profile);
+    bool getAllProfiles(org::maemo::vicar::ProfileList* profileList);
+    bool findProfileByNumber(QString number,org::maemo::vicar::Profile* profile);
+    bool deleteProfile(int id);
+    QSqlError lastError();
+
+private:
+    QSqlDatabase profilesDB;
+};
+
+#endif // DATABASEUTILITY_H
old mode 100644 (file)
new mode 100755 (executable)
index 2e7ea39..0065648
@@ -1,6 +1,6 @@
 /*
-@version: 0.2
-@author: Sudheer K. <scifi.guy@hotmail.com>
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
 @license: GNU General Public License
 */
 
@@ -9,20 +9,27 @@
 #include <QDebug>
 
 
-//Construction is available in the header file due to a peculiar issue with systemBus() function.
-
+DbusUtility::DbusUtility(QObject *parent):
+    QObject(parent),
+    connection(QDBusConnection::systemBus()){
+}
 
 //Destructor for Dbus Utility object.
 DbusUtility::~DbusUtility(){
-    this->connection.disconnectFromBus(this->connection.baseService());
-    qDebug() << "Disconnected from system bus";
+    //this->connection.disconnectFromBus(this->connection.baseService());
+    //qDebug() << "Disconnected from system bus";
 }
 
-QDBusConnection DbusUtility::getConnection(){
-    if (!this->connection.isConnected()){
-        qDebug() << "Not connected to Dbus";
+QDBusConnection DbusUtility::getConnection(bool systemBus){
+    if (systemBus){
+        if (!this->connection.isConnected()){
+            qDebug() << "Not connected to Dbus";
+        }
+        return this->connection;
+    }
+    else{
+        return QDBusConnection::sessionBus();
     }
-    return this->connection;
 }
 
 void DbusUtility::setConnection(QDBusConnection connection){
old mode 100644 (file)
new mode 100755 (executable)
index 3434c53..87a991e
@@ -1,6 +1,6 @@
 /*
-@version: 0.2
-@author: Sudheer K. <scifi.guy@hotmail.com>
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
 @license: GNU General Public License
 */
 
 #define NOTIFICATION_PATH       "/org/freedesktop/Notifications"
 #define NOTIFICATION_INTERFACE  "org.freedesktop.Notifications"
 
-class DbusUtility
+class DbusUtility: public QObject
 {
+ Q_OBJECT
 protected:
     QDBusConnection connection;
 public:
-    DbusUtility():connection(QDBusConnection::systemBus())
-    {}
+    DbusUtility(QObject * parent = 0);
     ~DbusUtility();
-    QDBusConnection getConnection();
+    QDBusConnection getConnection(bool systemBus = true);
     void setConnection(QDBusConnection connection);
     bool sendSignal(QString strPath,QString strInterface,QString strName);
     bool sendMethodCall(QString strService,QString strPath,
old mode 100644 (file)
new mode 100755 (executable)
index 542f7ee..aa6a296
@@ -1,6 +1,6 @@
 /*
-@version: 0.2
-@author: Sudheer K. <scifi.guy@hotmail.com>
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
 @license: GNU General Public License
 */
 
old mode 100644 (file)
new mode 100755 (executable)
index 9043aed..84879ac
@@ -1,6 +1,6 @@
 /*
-@version: 0.2
-@author: Sudheer K. <scifi.guy@hotmail.com>
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
 @license: GNU General Public License
 */
 
diff --git a/src/vicar-lib/src/telepathyutility.cpp b/src/vicar-lib/src/telepathyutility.cpp
new file mode 100644 (file)
index 0000000..259ad0c
--- /dev/null
@@ -0,0 +1,208 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+*/
+
+#include "telepathyutility.h"
+#include "accountmanagerproxy.h"
+#include "accountproxy.h"
+#include "accountcompatproxy.h"
+#include <QDBusInterface>
+#include <QDBusConnection>
+#include <QStringList>
+#include <QDBusPendingReply>
+#include <QDBusObjectPath>
+#include <QDebug>
+
+using namespace org::freedesktop::Telepathy;
+
+TelepathyUtility::TelepathyUtility(QObject *parent) :
+    QObject(parent)
+{
+}
+
+TelepathyUtility::~TelepathyUtility(){
+
+}
+
+//Get a list of all Telepathy accounts
+QList<QDBusObjectPath> TelepathyUtility::getAllAccounts(){
+
+    QList<QDBusObjectPath> objPathList;
+
+    QDBusInterface *iface = new QDBusInterface(AM_SERVICE,AM_OBJ_PATH,DBUS_PROPS_IFACE,QDBusConnection::sessionBus(),this);
+    if (iface->isValid()){
+        QDBusReply<QDBusVariant> reply = iface->call(QDBus::AutoDetect,"Get",AM_INTERFACE,"ValidAccounts");
+
+        if (reply.isValid()){;
+            QDBusVariant validAccounts = reply.value();
+            const QVariant var = validAccounts.variant();
+            const QDBusArgument arg = var.value<QDBusArgument>();
+
+            arg.beginArray();
+            while (!arg.atEnd()){
+                QDBusObjectPath opath;
+                arg >> opath;
+                if (opath.path().contains("tel")){
+                    qDebug() << opath.path();
+                }
+                objPathList.append(opath);
+            }
+            arg.endArray();
+        }
+        else{
+            qDebug() << "Error occurred while fetching accounts list "<<reply.error();
+        }
+    }
+    else{
+        qDebug() << "Error occurred while connecting to DBus interface";
+    }
+
+    return objPathList;
+
+}
+
+//Check if Vicar telepathy account exists
+bool TelepathyUtility::accountExists(){
+    bool vicarAccountExists = false;
+    QList<QDBusObjectPath> accountsList = this->getAllAccounts();
+    QDBusObjectPath account;
+    foreach (account,accountsList){
+        if (account.path().contains("vicar/tel/vicar")){
+            vicarAccountExists = true;
+            break;
+        }
+    }
+
+    return vicarAccountExists;
+}
+
+//Get telepathy account status
+QString TelepathyUtility::getAccountStatus(){
+
+    QString status = "Not Available";
+
+    QList<QDBusObjectPath> accountsList = this->getAllAccounts();
+    QDBusObjectPath account;
+    foreach (account,accountsList){
+        if (account.path().contains("vicar/tel/vicar")){
+            AccountProxy *accountProxy = new AccountProxy(AM_SERVICE,account.path(),QDBusConnection::sessionBus(),this);
+            if (accountProxy->isValid()){
+                uint intStatus = accountProxy->property("ConnectionStatus").toUInt();
+                //Based on http://telepathy.freedesktop.org/spec/Connection.html#Connection_Status
+                switch(intStatus){
+                case 0:
+                    status = "Connected";
+                    break;
+                case 1:
+                    status = "Connecting";
+                    break;
+                case 2:
+                    status = "Disconnected";
+                    break;
+                }
+            }
+        }
+    }
+
+    return status;
+}
+
+//Create Vicar telepathy account (used installation)
+bool TelepathyUtility::createAccount(){
+
+    AccountManagerProxy *amProxy = new AccountManagerProxy(AM_SERVICE,AM_OBJ_PATH,QDBusConnection::sessionBus(),this);
+
+    QMap<QString,QVariant> connectionParametersMap;
+    connectionParametersMap.insert("account","vicar");
+
+    QList<QVariant> presenceDetails;
+    uint presenceType(2); //Available = 2
+    presenceDetails << presenceType;
+    presenceDetails << "online";
+    presenceDetails << "Available";
+
+    SimplePresence presence;
+    presence.type = presenceType;
+    presence.status = "online";
+    presence.statusMessage = "Available";
+
+    QMap<QString,QVariant> accountPropertiesMap;
+    accountPropertiesMap.insert("org.freedesktop.Telepathy.Account.AutomaticPresence",QVariant::fromValue(presence));
+    accountPropertiesMap.insert("org.freedesktop.Telepathy.Account.Enabled",true);
+    accountPropertiesMap.insert("org.freedesktop.Telepathy.Account.ConnectAutomatically",true);
+    accountPropertiesMap.insert("org.freedesktop.Telepathy.Account.RequestedPresence",QVariant::fromValue(presence));
+    accountPropertiesMap.insert("com.nokia.Account.Interface.Compat.Profile","vicar");
+
+    QStringList valuesList;
+    valuesList.append("TEL");
+    accountPropertiesMap.insert("com.nokia.Account.Interface.Compat.SecondaryVCardFields",valuesList);
+
+    QDBusPendingReply<QDBusObjectPath> reply = amProxy->CreateAccount("vicar","tel","Vicar",connectionParametersMap,accountPropertiesMap);
+    reply.waitForFinished();
+
+    if (reply.isValid()){
+        QDBusObjectPath account = reply.value();
+        qDebug() << account.path() <<" created successfully.";
+
+        AccountCompatProxy *accountCompatProxy = new AccountCompatProxy(AM_SERVICE,account.path(),QDBusConnection::sessionBus(),this);
+        if (accountCompatProxy->isValid()){
+            QDBusPendingReply<> dbusReply = accountCompatProxy->SetHasBeenOnline();
+            dbusReply.waitForFinished();
+            if (dbusReply.isError()){
+                qDebug() << "Error occurred while setting HasBeenOnline property "<<dbusReply.error();
+                return false;
+            }
+        }
+    }
+    else{
+        qDebug() << "Error creating VICaR telepathy account "<<reply.error();
+        return false;
+    }
+
+    return true;
+}
+
+//Delete Vicar telepathy account (used during uninstallation)
+bool TelepathyUtility::deleteAccount(){
+
+    QList<QDBusObjectPath> accountsList = this->getAllAccounts();
+    QDBusObjectPath account;
+    foreach (account,accountsList){
+        if (account.path().contains("vicar/tel/vicar")){
+            AccountProxy *accountProxy = new AccountProxy(AM_SERVICE,account.path(),QDBusConnection::sessionBus(),this);
+            if (accountProxy->isValid()){
+                QDBusPendingReply<> dbusReply = accountProxy->Remove();
+                dbusReply.waitForFinished();
+                if (dbusReply.isError()){
+                    qDebug() << "Error occurred while removing VICaR account "<<dbusReply.error();
+                    return false;
+                }
+                else{
+                    qDebug() <<"VICaR account deleted";
+                }
+            }
+        }
+    }
+
+    return true;
+}
+
+// Marshall the Presence data into a D-Bus argument
+ QDBusArgument &operator<<(QDBusArgument &argument, const SimplePresence &simplePresence)
+ {
+     argument.beginStructure();
+     argument <<  simplePresence.type << simplePresence.status << simplePresence.statusMessage;
+     argument.endStructure();
+     return argument;
+ }
+
+ // Retrieve the Presence data from the D-Bus argument
+ const QDBusArgument &operator>>(const QDBusArgument &argument, SimplePresence &simplePresence)
+ {
+     argument.beginStructure();
+     argument >> simplePresence.type >> simplePresence.status >> simplePresence.statusMessage;
+     argument.endStructure();
+     return argument;
+ }
diff --git a/src/vicar-lib/src/telepathyutility.h b/src/vicar-lib/src/telepathyutility.h
new file mode 100644 (file)
index 0000000..d39f7f3
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+*/
+
+#ifndef TELEPATHYUTILITY_H
+#define TELEPATHYUTILITY_H
+
+#include <QObject>
+#include <QDBusObjectPath>
+#include <QDBusArgument>
+
+
+#define AM_SERVICE          "org.freedesktop.Telepathy.AccountManager"
+#define AM_OBJ_PATH         "/org/freedesktop/Telepathy/AccountManager"
+#define AM_INTERFACE        "org.freedesktop.Telepathy.AccountManager"
+#define DBUS_SERVICE        "org.freedesktop.DBus.Properties"
+#define DBUS_OBJ_PATH       "/org/freedesktop/DBus/Properties"
+#define DBUS_PROPS_IFACE     "org.freedesktop.DBus.Properties"
+
+namespace org {
+namespace freedesktop {
+namespace Telepathy {
+struct SimplePresence
+{
+    uint type;
+    QString status;
+    QString statusMessage;
+};
+}//Telepathy
+}//freedesktop
+}//org
+
+Q_DECLARE_METATYPE(org::freedesktop::Telepathy::SimplePresence);
+
+bool operator==(const org::freedesktop::Telepathy::SimplePresence& v1, const org::freedesktop::Telepathy::SimplePresence& v2);
+inline bool operator!=(const org::freedesktop::Telepathy::SimplePresence& v1, const org::freedesktop::Telepathy::SimplePresence& v2)
+{
+    return !operator==(v1, v2);
+}
+QDBusArgument& operator<<(QDBusArgument& arg, const org::freedesktop::Telepathy::SimplePresence& val);
+const QDBusArgument& operator>>(const QDBusArgument& arg, org::freedesktop::Telepathy::SimplePresence& val);
+
+class TelepathyUtility : public QObject
+{
+    Q_OBJECT
+public:
+    TelepathyUtility(QObject *parent = 0);
+    ~TelepathyUtility();
+    QList<QDBusObjectPath> getAllAccounts();
+    QString getAccountStatus();
+    bool accountExists();
+    bool createAccount();
+    bool deleteAccount();
+};
+
+#endif // TELEPATHYUTILITY_H
diff --git a/src/vicar-lib/src/vicarprofiletypes.h b/src/vicar-lib/src/vicarprofiletypes.h
new file mode 100644 (file)
index 0000000..c43a580
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef VICARPROFILETYPES_H
+#define VICARPROFILETYPES_H
+
+#include <QString>
+#include <QList>
+#include <QMetaType>
+
+namespace org {
+namespace maemo {
+namespace vicar {
+
+class Profile
+{
+public:
+    uint    profileID;
+    QString phoneNumberPattern;
+    QString gatewayNumber;
+    QString dtmfFormat;
+    QString dtmfPrefix;
+    QString dtmfSuffix;
+};
+typedef QList<Profile> ProfileList;
+
+} // namespace vicar
+} // namespace maemo
+} // namespace org
+
+Q_DECLARE_METATYPE(org::maemo::vicar::Profile)
+Q_DECLARE_METATYPE(org::maemo::vicar::ProfileList)
+
+#endif // VICARPROFILETYPES_H
old mode 100644 (file)
new mode 100755 (executable)
index ef26364..25b0bc3
@@ -5,7 +5,7 @@ INCLUDEPATH += /usr/include/gconf/2 \
 LIBS += /usr/lib/libgconf-2.so
 CONFIG += qt debug staticlib
 CONFIG -= gui
-QT += dbus
+QT += dbus sql
 QT -= gui
 TARGET = vicar
 TEMPLATE = lib
@@ -15,9 +15,20 @@ OBJECTS_DIR = objs
 DESTDIR = ../lib
 
 SOURCES += src/dbusutility.cpp \
-    src/gconfutility.cpp
+    src/gconfutility.cpp \
+    src/telepathyutility.cpp \
+    src/accountmanagerproxy.cpp \
+    src/accountproxy.cpp \
+    src/accountcompatproxy.cpp \
+    src/databaseutility.cpp
 HEADERS += src/dbusutility.h \
-    src/gconfutility.h
+    src/gconfutility.h \
+    src/telepathyutility.h \
+    src/accountmanagerproxy.h \
+    src/accountproxy.h \
+    src/accountcompatproxy.h \
+    src/databaseutility.h \
+    src/vicarprofiletypes.h
 
 #MAKE INSTALL
 INSTALLDIR = /../../debian/vicar
diff --git a/src/vicar-telepathy/src/basetypes.h b/src/vicar-telepathy/src/basetypes.h
new file mode 100644 (file)
index 0000000..28ddabd
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * QtTelepathy, the Tapioca Qt4 Telepathy Client Library
+ * Copyright (C) 2006 by Tobias Hunger <tobias.hunger@basyskom.de>
+ * Copyright (C) 2006 by INdT
+ *  @author Andre Moreira Magalhaes <andre.magalhaes@indt.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef QTTELEPATHY_BASETYPES_H
+#define QTTELEPATHY_BASETYPES_H
+
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QVariant>
+#include <QtCore/QVariantMap>
+
+Q_DECLARE_METATYPE(QList<uint>)
+Q_DECLARE_METATYPE(QVariantMap)
+
+#endif
+
diff --git a/src/vicar-telepathy/src/connection.cpp b/src/vicar-telepathy/src/connection.cpp
new file mode 100644 (file)
index 0000000..236ded5
--- /dev/null
@@ -0,0 +1,480 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+
+Based on Telepathy-SNOM with copyright notice below.
+*/
+
+/*
+ * Telepathy SNOM VoIP phone connection manager
+ * Copyright (C) 2006 by basyskom GmbH
+ *  @author Tobias Hunger <info@basyskom.de>
+ *
+ * This library is free software; you can redisQObject::tribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is disQObject::tributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin SQObject::treet, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "connection.h"
+#include "connectionadaptor.h"
+#include "connectioninterfacerequestsadaptor.h"
+#include "connectioninterfacerequeststypes.h"
+#include "connectioninterfacecapabilitiesadaptor.h"
+#include "connectioninterfacecapabilitiestypes.h"
+#include "names.h"
+#include "vicarcallrouterproxy.h"
+
+#include <QtCore/QDebug>
+#include <QtCore/QCoreApplication>
+#include <QtCore/QVariantMap>
+#include <QDBusMessage>
+#include <QDBusReply>
+
+
+namespace
+{
+static const QString protocol_vicar("tel");
+
+static const QString connection_service_name_prefix("org.freedesktop.Telepathy.Connection.vicar." + protocol_vicar + '.');
+static const QString connection_object_path_prefix("/org/freedesktop/Telepathy/Connection/vicar/" + protocol_vicar + '/');
+static const QString requests_interface("org.freedesktop.Telepathy.Connection.Interface.Requests");
+}
+
+using namespace org::maemo;
+
+
+class ConnectionPrivate
+{
+public:
+    ConnectionPrivate(Connection * p,
+                      const QString & acc) :
+        account(acc),
+        connection_status(Connection::Disconnected),
+        adaptor(new ConnectionAdaptor(p)),
+        connIfaceReqsAdaptor(new ConnectionInterfaceRequestsAdaptor(p)),
+        parent(p)
+    {
+        Q_ASSERT(0 != adaptor);
+    }
+
+    ~ConnectionPrivate()
+    {
+        qDebug() << "VICaR: Connection Destructing";
+    }
+
+    const QString account;
+
+    Connection::Status connection_status;
+    ConnectionAdaptor * adaptor;
+    ConnectionInterfaceRequestsAdaptor * connIfaceReqsAdaptor;
+    Connection * const parent;
+};
+
+// ---------------------------------------------------------------------------
+
+Connection::Connection(const QString & account,
+                        QObject * parent) :
+    QObject(parent),
+    d(new ConnectionPrivate(this, account))
+{
+    Q_ASSERT(0 != d);
+    Q_ASSERT(!account.isEmpty());
+
+    /*  -- Set the Dynamic property "Interfaces" ---
+
+        Apparently it is not sufficient to implement an additional interface like Conn.I.Requests.
+        We have to assign the list of additional interfaces to the DBus Property Interfaces.
+
+        The actual DBus property "Interfaces" is declared in ConnectionAdaptor class,
+         which is our Connection Interface implementation.
+     */
+
+    QStringList interfaces = QStringList(requests_interface);
+    this->setProperty("Interfaces",interfaces);
+
+
+    //Set the property RequestableChannelClasses
+    org::freedesktop::Telepathy::RequestableChannelClassList requestableChannelClasses;
+
+    uint targetHandleType(1);
+
+    org::freedesktop::Telepathy::RequestableChannelClass requestableChannelClass1;
+    requestableChannelClass1.fixedProperties.insert("org.freedesktop.Telepathy.Channel.TargetHandleType",targetHandleType);
+    requestableChannelClass1.fixedProperties.insert("org.freedesktop.Telepathy.Channel.ChannelType","org.freedesktop.Telepathy.Channel.Type.StreamedMedia");
+
+    requestableChannelClass1.allowedProperties.append("org.freedesktop.Telepathy.Channel.TargetHandle");
+    requestableChannelClass1.allowedProperties.append("org.freedesktop.Telepathy.Channel.Type.StreamedMedia.InitialAudio");
+
+    requestableChannelClasses.append(requestableChannelClass1);
+
+    org::freedesktop::Telepathy::RequestableChannelClass requestableChannelClass2;
+    requestableChannelClass2.fixedProperties.insert("org.freedesktop.Telepathy.Channel.TargetHandleType",targetHandleType);
+    requestableChannelClass2.fixedProperties.insert("org.freedesktop.Telepathy.Channel.ChannelType","org.freedesktop.Telepathy.Channel.Type.StreamedMedia");
+
+    requestableChannelClass2.allowedProperties.append("com.nokia.Telepathy.Channel.Interface.Conference.InitialMembers");
+    requestableChannelClass2.allowedProperties.append("org.freedesktop.Telepathy.Channel.TargetHandleType");
+    requestableChannelClass2.allowedProperties.append("org.freedesktop.Telepathy.Channel.Type.StreamedMedia.InitialAudio");
+
+    requestableChannelClasses.append(requestableChannelClass2);
+
+
+    this->setProperty("RequestableChannelClasses",QVariant::fromValue(requestableChannelClasses));
+
+
+
+    qDebug() << "VICaR: Connection set up.";
+}
+
+Connection::~Connection()
+{
+    qDebug() << "VICaR: Connection closed.";
+    delete(d);
+}
+
+bool Connection::registerObject()
+{
+    if (!QDBusConnection::sessionBus().registerService(serviceName()))
+    {
+        qDebug() << "VICaR: Problem registering connection service:" << serviceName();
+        return false;
+    }
+
+    if (!QDBusConnection::sessionBus().registerObject(objectPath().path(),
+                                                      this))
+    {
+        qDebug() << "VICaR: Problem registering object path:" << objectPath().path();
+        return false;
+    }
+    return true;
+}
+
+void Connection::unregisterObject()
+{
+    qDebug() << "VICaR: Unregistering Connection object from DBus";
+    QDBusConnection::sessionBus().unregisterObject(objectPath().path());
+    QDBusConnection::sessionBus().unregisterService(serviceName());
+}
+
+QString Connection::name() const
+{    
+    return QString("vicar");
+}
+
+
+QString Connection::serviceName() const
+{ return connection_service_name_prefix + name(); }
+
+QDBusObjectPath Connection::objectPath() const
+{ return QDBusObjectPath(connection_object_path_prefix + name()); }
+
+
+//org.freedesktop.Telepathy.Connection
+void Connection::Connect()
+{
+    /*
+       Since this is not a "real" Telepathy Connection to a SIP, Chat server,
+       I am not connecting to anything.
+     */
+    qDebug() << "VICaR: Changing status to Connected...";
+    d->connection_status = Connection::Connected;
+
+    //Let all the Telepathy clients know that connection status has changed
+    qDebug() << "VICaR: Emitting StatusChanged.";
+    emit StatusChanged(d->connection_status, ReasonRequested);
+
+}
+
+void Connection::Disconnect()
+{
+    qDebug() << "VICaR: Changing status to Disconnected...";
+    //We don't have any Handles to release here. So just change the status to Disconnected
+    d->connection_status = Connection::Disconnected;
+
+    qDebug() << "VICaR: Emitting StatusChanged";
+    emit StatusChanged(d->connection_status, ReasonRequested);
+
+    //As per Telepathy specfication, on disconnect we need to unregister from Dbus and destroy the object.
+    unregisterObject();
+    deleteLater();
+}
+
+QStringList Connection::GetInterfaces()
+{
+    QStringList result;
+    if (d->connection_status != Connected)
+    {
+        sendErrorReply("org.freedesktop.Telepathy.Error.Disconnected",
+                       "VICaR - Unable to get Interfaces List. The connection is no longer available.");
+        return result;
+    }    
+    result <<requests_interface;
+    return result;
+}
+
+QString Connection::GetProtocol()
+{ return protocol_vicar; }
+
+uint Connection::GetStatus()
+{ return static_cast<uint>(d->connection_status); }
+
+uint Connection::GetSelfHandle()
+{
+    qDebug() << "VICaR: GetSelfHandle";
+    if (d->connection_status != Connected)
+    {
+        sendErrorReply("org.freedesktop.Telepathy.Error.Disconnected",
+                       "VICaR - Unable to get Self Handle. The connection is no longer available.");
+        qDebug() << "VICaR: NOT CONNECTED when requesting selfhandle!";
+        return 0;
+    }
+
+    //WARNING: Incomplete implemenation
+    uint handle = 0;
+    qDebug() << "VICaR: Returning Handle" << handle << "as self handle.";
+    return handle;
+}
+
+QList<uint> Connection::RequestHandles(uint handle_type,
+                                       const QStringList & names)
+{
+    Q_UNUSED(names);
+    QList<uint> result;
+
+    // check input:
+    if (d->connection_status != Connected)
+    {
+        sendErrorReply("org.freedesktop.Telepathy.Error.Disconnected",
+                       "VICaR - Unable to process handle request. The connection is no longer available.");
+        return result;
+    }
+    if (handle_type != HandleContact)
+    {
+        sendErrorReply("org.freedesktop.Telepathy.Error.InvalidArgument",
+                       "VICaR - Supports handles of type Contact only.");
+        return result;
+    }
+
+    //WARNING: Incomplete implementation. Create a handle and return the value here.
+    return result;
+}
+
+void Connection::HoldHandles(const uint handle_type, const QList<uint> &handles)
+{
+    Q_UNUSED(handles);
+    qDebug() << "VICaR: HoldHandles.";
+    if (d->connection_status != Connected)
+    {
+        sendErrorReply("org.freedesktop.Telepathy.Error.Disconnected",
+                       "VICaR - Unable to process handle request. The connection is no longer available.");
+        return;
+    }
+    if (handle_type != HandleContact)
+    {
+        sendErrorReply("org.freedesktop.Telepathy.Error.InvalidArgument",
+                       "VICaR - Supports handles of type Contact only.");
+        return;
+    }
+
+    //WARNING: Incomplete implementation
+}
+
+QStringList Connection::InspectHandles(const uint handle_type,
+                                       const QList<uint> &handles)
+{
+    Q_UNUSED(handles);
+    QStringList result;
+
+        // check input:
+    if (d->connection_status != Connected)
+    {
+        sendErrorReply("org.freedesktop.Telepathy.Error.Disconnected",
+                       "VICaR - Unable to process handle request. The connection is no longer available.");
+        return result;
+    }
+    if (handle_type != HandleContact)
+    {
+        sendErrorReply("org.freedesktop.Telepathy.Error.InvalidArgument",
+                       "VICaR - Supports handles of type Contact only.");
+        return result;
+    }
+
+    //WARNING: Incomplete implementation
+    return result;
+}
+
+void Connection::ReleaseHandles(const uint handle_type, const QList<uint> &handles)
+{
+    Q_UNUSED(handles);
+    if (d->connection_status != Connected)
+    {
+        sendErrorReply("org.freedesktop.Telepathy.Error.Disconnected",
+                       "VICaR - Unable to release handle. The connection is no longer available.");
+        qDebug() << "VICaR: Releasing Handle while connection is no longer connected.";
+        return;
+    }
+    if (handle_type != HandleContact)
+    {
+        sendErrorReply("org.freedesktop.Telepathy.Error.InvalidArgument",
+                       "VICaR - Supports handles of type Contact only.");
+        qDebug() << "VICaR: Trying to release a Handle that is not a contact.";
+        return;
+    }
+
+    //WARNING: Incomplete implementation
+}
+
+org::freedesktop::Telepathy::ChannelInfoList Connection::ListChannels()
+{
+    org::freedesktop::Telepathy::ChannelInfoList result;
+    if (d->connection_status != Connected)
+    {
+        sendErrorReply("org.freedesktop.Telepathy.Error.Disconnected",
+                       "VICaR - Unable to list channels. The connection is no longer available.");
+        return result;
+    }
+
+    //WARNING: Incomplete implementation
+    //Btw - We never have any channels :)
+
+    return result;
+}
+
+QDBusObjectPath Connection::RequestChannel(const QString &type,
+                                           uint handle_type, uint handle,
+                                           bool suppress_handler)
+{
+    Q_UNUSED(handle);
+    Q_UNUSED(suppress_handler);
+    //This method is deprecated and no longer used as per latest Telepathy spec
+
+    if (type != QString("org.freedesktop.Telepathy.Channel.Type.StreamedMedia"))
+    {
+        sendErrorReply("org.freedesktop.Telepathy.Error.NotImplemented",
+                       "VICaR: Failed to create channel: Channel type not implemented.");
+        return QDBusObjectPath();
+    }
+
+    if (handle_type != HandleContact )
+    {
+        sendErrorReply("org.freedesktop.Telepathy.Error.InvalidHandle",
+                       "VICaR: Failed to create channel: Handle type not supported.");
+        return QDBusObjectPath();
+    }
+
+    if (d->connection_status != Connected)
+    {
+        sendErrorReply("org.freedesktop.Telepathy.Error.Disconnected",
+                       "VICaR: Failed to create channel: Connection is Disconnected.");
+        return QDBusObjectPath();
+    }
+
+    //TODO VICaR Specific code here
+
+    //WARNING: Incomplete implementation, we are not creating any channels here at all.
+    QDBusObjectPath channel_path;
+    return channel_path;
+}
+
+//org.freedesktop.Telepathy.Connection.Interface.Requests
+QDBusObjectPath Connection::CreateChannel(const QVariantMap &request,
+                                                           QVariantMap &channel_properties)
+{
+    Q_UNUSED(channel_properties);
+    Q_ASSERT(!request.isEmpty());
+    qDebug() << "VICaR: CreateChannel";
+    qDebug() << " Request details are: "<< request;
+
+     //Ideally we need to emit NewChannels signal here, but since we are not creating any channels we ignore it
+
+    //WARNING: VICaR - Specific implementation
+    return processChannel(request);
+
+}
+
+bool Connection::EnsureChannel(const QVariantMap &request,
+                                                QDBusObjectPath &channel_object,
+                                                QVariantMap &channel_properties)
+{
+    Q_UNUSED(channel_object);
+    Q_UNUSED(channel_properties);
+    Q_ASSERT(!request.isEmpty());
+    qDebug() << "VICaR: EnsureChannel";
+    qDebug() << " Request details are: "<< request;
+
+    //WARNING: Incomplete implementation
+    processChannel(request);
+
+    return true;
+}
+
+QDBusObjectPath Connection::processChannel(const QVariantMap &request){
+
+    QDBusObjectPath channel_path;
+
+    if (!request.contains("org.freedesktop.Telepathy.Channel.TargetID")){
+        sendErrorReply("org.freedesktop.Telepathy.Error.InvalidArgument",
+                       "VICaR - Invalid request. TargetID (Phone Number) not included.");
+        return channel_path;
+    }
+
+    QVariant vNumber = request.value("org.freedesktop.Telepathy.Channel.TargetID");
+    if (!vNumber.isValid()){
+        sendErrorReply("org.freedesktop.Telepathy.Error.InvalidArgument",
+                       "VICaR - Invalid request. Phone Number is not valid.");
+        return channel_path;
+    }
+    QString strNumber = vNumber.toString();
+    if (strNumber.isEmpty()){
+        sendErrorReply("org.freedesktop.Telepathy.Error.InvalidArgument",
+                       "VICaR - Invalid request. Phone Number is empty.");
+        return channel_path;
+    }
+
+    /*
+        Send an error reply to Tp Client (Mission Control) to force it to close the active channel.
+        Once it recieves the reply, the client does not bother what we return.
+
+     */
+
+    sendErrorReply("org.freedesktop.Telepathy.Error.NotAvailable",
+                   "VICaR - Creating a new channel to "+strNumber+" via Ring.");
+
+
+    //Initiate a new call to CC/Google Out/Skype-out number by requesting a new channel with Ring CM.
+
+    VicarCallRouterProxy *callRouter = new VicarCallRouterProxy(APPLICATION_DBUS_SERVICE,APPLICATION_DBUS_PATH,QDBusConnection::sessionBus(),this);
+
+    callRouter->callInternationalNumber(strNumber);
+
+    qDebug() << "VICaR: Call is processed.";
+
+    return channel_path;
+}
+
+
+//org.freedesktop.Telepathy.Connection.Interface.Capabilities
+org::freedesktop::Telepathy::ContactCapabilitiesList Connection::GetCapabilities(const QList<uint> &Handles){
+    Q_UNUSED(Handles);
+    org::freedesktop::Telepathy::ContactCapabilitiesList capabilities;
+    return capabilities;
+
+}
+
+
+org::freedesktop::Telepathy::CapabilityPairList Connection::AdvertiseCapabilities(org::freedesktop::Telepathy::CapabilityPairList Add, const QStringList &Remove){
+    Q_UNUSED(Add);
+    Q_UNUSED(Remove);
+    org::freedesktop::Telepathy::CapabilityPairList capabilities;
+    return capabilities;
+}
diff --git a/src/vicar-telepathy/src/connection.h b/src/vicar-telepathy/src/connection.h
new file mode 100644 (file)
index 0000000..ea214f4
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+
+Based on Telepathy-SNOM with copyright notice below.
+*/
+
+/*
+ * Telepathy SNOM VoIP phone connection manager
+ * Copyright (C) 2006 by basyskom GmbH
+ *  @author Tobias Hunger <info@basyskom.de>
+ *
+ * This library is free software; you can redisQObject::tribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is disQObject::tributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin SQObject::treet, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef _VICAR_CONNECTION_H_
+#define _VICAR_CONNECTION_H_
+
+#include "connectiontypes.h"
+#include "connectioninterfacerequeststypes.h"
+#include "connectioninterfacecapabilitiestypes.h"
+
+#include <QtDBus/QDBusContext>
+#include <QtDBus/QtDBus>
+
+class ConnectionPrivate;
+
+class Connection : public QObject, protected QDBusContext
+{
+    Q_OBJECT
+
+public:
+    explicit Connection(const QString & account,
+                        QObject * parent = 0);
+    ~Connection();
+
+    QString name() const;
+    QString serviceName() const;
+    QDBusObjectPath objectPath() const;
+
+    bool registerObject();
+    void unregisterObject();
+
+    enum Status
+    {
+        Connected = 0,
+        Connecting = 1,
+        Disconnected = 2
+    };
+
+    enum Reason
+    {
+        ReasonNone = 0,
+        ReasonRequested = 1,
+        ReasonNetworkError = 2,
+        ReasonAuthenticationFailed = 3,
+        ReasonEncryptionError = 4,
+        ReasonNameInUse = 5,
+        ReasonCertNotProvided = 6,
+        ReasonCertUntrusted = 7,
+        ReasonCertExpired = 8,
+        ReasonCertNotActivated = 9,
+        ReasonCertHostnameMismatch = 10,
+        ReasonCertFingerprintMismatch = 11,
+        ReasonCertSelfSigned = 12,
+        ReasonCertOtherError = 13
+    };
+
+    enum Handle
+    {
+        HandleNone = 0,
+        HandleContact = 1,
+        HandleRoom = 2,
+        HandleRoomList = 3,
+        HandleGroup = 4
+    };
+
+public slots:
+    //org.freedesktop.Telepathy.Connection
+    void Connect();
+    void Disconnect();
+
+    QStringList GetInterfaces();
+    QString GetProtocol();
+    uint GetStatus();
+
+    uint GetSelfHandle();
+    QList<uint> RequestHandles(const uint handle_type, const QStringList &names);
+    void HoldHandles(const uint handle_type, const QList<uint> &handles);
+    QStringList InspectHandles(const uint handle_type, const QList<uint> &handles);
+    void ReleaseHandles(const uint handle_type, const QList<uint> &handles);
+
+    org::freedesktop::Telepathy::ChannelInfoList ListChannels();
+    QDBusObjectPath RequestChannel(const QString &type,
+                                   uint handle_type, uint handle,
+                                   bool suppress_handler);
+
+    //org.freedesktop.Telepathy.Connection.Interface.Requests
+    QDBusObjectPath CreateChannel(const QVariantMap &request,
+                                  QVariantMap &channel_properties);
+
+    bool EnsureChannel(const QVariantMap &request,
+                       QDBusObjectPath &channel_object,
+                       QVariantMap &channel_properties);
+    //org.freedesktop.Telepathy.Connection.Interface.Capabilities
+    org::freedesktop::Telepathy::CapabilityPairList AdvertiseCapabilities(org::freedesktop::Telepathy::CapabilityPairList Add,
+                                                                          const QStringList &Remove);
+    org::freedesktop::Telepathy::ContactCapabilitiesList GetCapabilities(const QList<uint> &Handles);
+
+protected slots:
+    QDBusObjectPath processChannel(const QVariantMap &request);
+
+signals:
+    void NewChannel(const QDBusObjectPath & object_path,
+                    const QString & channel_type,
+                    uint handle_type, uint handle,
+                    bool suppress_handler);
+    void StatusChanged(uint status, uint reason);
+
+    //org.freedesktop.Telepathy.Connection.Interface.Requests
+    void ChannelClosed(const QDBusObjectPath &removed_channel_object);
+    void NewChannels(org::freedesktop::Telepathy::ChannelDetailsList new_channels);
+
+    //org.freedesktop.Telepathy.Connection.Interface.Capabilities
+    void CapabilitiesChanged(org::freedesktop::Telepathy::CapabilityChangeList changes);
+
+private:
+    Connection(const Connection &); // no impl.
+    ConnectionPrivate * const d;
+};
+
+#endif
diff --git a/src/vicar-telepathy/src/connectionadaptor.cpp b/src/vicar-telepathy/src/connectionadaptor.cpp
new file mode 100644 (file)
index 0000000..09ef293
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ * This file was generated by dbusxml2cpp version 0.6
+ * Command line was: dbusxml2cpp -i QtTelepathy/Core/ConnectionAdaptor -i QtTelepathy/Common/ConnectionTypes -a :src/Core/connectionadaptor.cpp xml/tp-conn.xml
+ *
+ * dbusxml2cpp is Copyright (C) 2006 Trolltech ASA. All rights reserved.
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#include "connectionadaptor.h"
+#include "connectiontypes.h"
+#include <QtCore/QMetaObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+#include <QtCore/QDebug>
+
+/*
+ * Implementation of adaptor class ConnectionAdaptor
+ */
+
+ConnectionAdaptor::ConnectionAdaptor(QObject *parent)
+    : QDBusAbstractAdaptor(parent)
+{
+    // constructor
+    setAutoRelaySignals(true);
+}
+
+ConnectionAdaptor::~ConnectionAdaptor()
+{
+    // destructor
+}
+
+QStringList ConnectionAdaptor::Interfaces() const
+{
+    // get the value of property Interfaces
+    return qvariant_cast< QStringList >(parent()->property("Interfaces"));
+}
+
+void ConnectionAdaptor::Connect()
+{
+    // handle method call org.freedesktop.Telepathy.Connection.Connect
+    QMetaObject::invokeMethod(parent(), "Connect");
+}
+
+void ConnectionAdaptor::Disconnect()
+{
+    // handle method call org.freedesktop.Telepathy.Connection.Disconnect
+    QMetaObject::invokeMethod(parent(), "Disconnect");
+}
+
+QStringList ConnectionAdaptor::GetInterfaces()
+{
+    // handle method call org.freedesktop.Telepathy.Connection.GetInterfaces
+    QStringList out0;
+    QMetaObject::invokeMethod(parent(), "GetInterfaces", Q_RETURN_ARG(QStringList, out0));
+    return out0;
+}
+
+QString ConnectionAdaptor::GetProtocol()
+{
+    // handle method call org.freedesktop.Telepathy.Connection.GetProtocol
+    QString out0;
+    QMetaObject::invokeMethod(parent(), "GetProtocol", Q_RETURN_ARG(QString, out0));
+    return out0;
+}
+
+uint ConnectionAdaptor::GetSelfHandle()
+{
+    // handle method call org.freedesktop.Telepathy.Connection.GetSelfHandle
+    uint out0;
+    QMetaObject::invokeMethod(parent(), "GetSelfHandle", Q_RETURN_ARG(uint, out0));
+    return out0;
+}
+
+uint ConnectionAdaptor::GetStatus()
+{
+    // handle method call org.freedesktop.Telepathy.Connection.GetStatus
+    uint out0;
+    QMetaObject::invokeMethod(parent(), "GetStatus", Q_RETURN_ARG(uint, out0));
+    return out0;
+}
+
+void ConnectionAdaptor::HoldHandles(uint handle_type, const QList<uint> &handles)
+{
+    qDebug() << "HoldHandles called from external!" << handles;
+    // handle method call org.freedesktop.Telepathy.Connection.HoldHandles
+    QMetaObject::invokeMethod(parent(), "HoldHandles", Q_ARG(uint, handle_type), Q_ARG(QList<uint>, handles));
+}
+
+QStringList ConnectionAdaptor::InspectHandles(uint handle_type, const QList<uint> &handles)
+{
+    // handle method call org.freedesktop.Telepathy.Connection.InspectHandles
+    QStringList out0;
+    QMetaObject::invokeMethod(parent(), "InspectHandles", Q_RETURN_ARG(QStringList, out0), Q_ARG(uint, handle_type), Q_ARG(QList<uint>, handles));
+    return out0;
+}
+
+org::freedesktop::Telepathy::ChannelInfoList ConnectionAdaptor::ListChannels()
+{
+    // handle method call org.freedesktop.Telepathy.Connection.ListChannels
+    org::freedesktop::Telepathy::ChannelInfoList out0;
+    QMetaObject::invokeMethod(parent(), "ListChannels", Q_RETURN_ARG(org::freedesktop::Telepathy::ChannelInfoList, out0));
+    return out0;
+}
+
+void ConnectionAdaptor::ReleaseHandles(uint handle_type, const QList<uint> &handles)
+{
+    qDebug() << "ReleaseHandles called from external!" << handles;
+    // handle method call org.freedesktop.Telepathy.Connection.ReleaseHandles
+    QMetaObject::invokeMethod(parent(), "ReleaseHandles", Q_ARG(uint, handle_type), Q_ARG(QList<uint>, handles));
+}
+
+QDBusObjectPath ConnectionAdaptor::RequestChannel(const QString &type, uint handle_type, uint handle, bool suppress_handler)
+{
+    // handle method call org.freedesktop.Telepathy.Connection.RequestChannel
+    QDBusObjectPath out0;
+    QMetaObject::invokeMethod(parent(), "RequestChannel", Q_RETURN_ARG(QDBusObjectPath, out0), Q_ARG(QString, type), Q_ARG(uint, handle_type), Q_ARG(uint, handle), Q_ARG(bool, suppress_handler));
+    return out0;
+}
+
+QList<uint> ConnectionAdaptor::RequestHandles(uint handle_type, const QStringList &names)
+{
+    // handle method call org.freedesktop.Telepathy.Connection.RequestHandles
+    QList<uint> out0;
+    QMetaObject::invokeMethod(parent(), "RequestHandles", Q_RETURN_ARG(QList<uint>, out0), Q_ARG(uint, handle_type), Q_ARG(QStringList, names));
+    return out0;
+}
+
diff --git a/src/vicar-telepathy/src/connectionadaptor.h b/src/vicar-telepathy/src/connectionadaptor.h
new file mode 100644 (file)
index 0000000..5b9a012
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * This file was generated by dbusxml2cpp version 0.6
+ * Command line was: dbusxml2cpp -i QtTelepathy/Common/BaseTypes -i QtTelepathy/Common/ConnectionTypes -a include/QtTelepathy/Core/connectionadaptor.h: xml/tp-conn.xml
+ *
+ * dbusxml2cpp is Copyright (C) 2006 Trolltech ASA. All rights reserved.
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#ifndef CONNECTIONADAPTOR_H_1172489892
+#define CONNECTIONADAPTOR_H_1172489892
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+#include "connectiontypes.h"
+class QByteArray;
+template<class T> class QList;
+template<class Key, class Value> class QMap;
+class QString;
+class QStringList;
+class QVariant;
+
+/*
+ * Adaptor class for interface org.freedesktop.Telepathy.Connection
+ */
+class ConnectionAdaptor: public QDBusAbstractAdaptor
+{
+    Q_OBJECT
+    Q_CLASSINFO("D-Bus Interface", "org.freedesktop.Telepathy.Connection")
+    Q_CLASSINFO("D-Bus Introspection", ""
+"  <interface name=\"org.freedesktop.Telepathy.Connection\" >\n"
+"    <property access=\"read\" type=\"as\" name=\"Interfaces\"/>\n"
+"    <method name=\"Connect\" />\n"
+"    <method name=\"Disconnect\" />\n"
+"    <method name=\"GetInterfaces\" >\n"
+"      <arg direction=\"out\" type=\"as\" />\n"
+"    </method>\n"
+"    <method name=\"GetProtocol\" >\n"
+"      <arg direction=\"out\" type=\"s\" />\n"
+"    </method>\n"
+"    <method name=\"GetSelfHandle\" >\n"
+"      <arg direction=\"out\" type=\"u\" />\n"
+"    </method>\n"
+"    <method name=\"GetStatus\" >\n"
+"      <arg direction=\"out\" type=\"u\" />\n"
+"    </method>\n"
+"    <method name=\"HoldHandles\" >\n"
+"      <annotation value=\"QList&lt;uint>\" name=\"com.trolltech.QtDBus.QtTypeName.In1\" />\n"
+"      <arg direction=\"in\" type=\"u\" name=\"handle_type\" />\n"
+"      <arg direction=\"in\" type=\"au\" name=\"handles\" />\n"
+"    </method>\n"
+"    <method name=\"InspectHandles\" >\n"
+"      <annotation value=\"QList&lt;uint>\" name=\"com.trolltech.QtDBus.QtTypeName.In1\" />\n"
+"      <arg direction=\"in\" type=\"u\" name=\"handle_type\" />\n"
+"      <arg direction=\"in\" type=\"au\" name=\"handles\" />\n"
+"      <arg direction=\"out\" type=\"as\" />\n"
+"    </method>\n"
+"    <method name=\"ListChannels\" >\n"
+"      <annotation value=\"org::freedesktop::Telepathy::ChannelInfoList\" name=\"com.trolltech.QtDBus.QtTypeName.Out0\" />\n"
+"      <arg direction=\"out\" type=\"a(osuu)\" />\n"
+"    </method>\n"
+"    <method name=\"ReleaseHandles\" >\n"
+"      <annotation value=\"QList&lt;uint>\" name=\"com.trolltech.QtDBus.QtTypeName.In1\" />\n"
+"      <arg direction=\"in\" type=\"u\" name=\"handle_type\" />\n"
+"      <arg direction=\"in\" type=\"au\" name=\"handles\" />\n"
+"    </method>\n"
+"    <method name=\"RequestChannel\" >\n"
+"      <arg direction=\"in\" type=\"s\" name=\"type\" />\n"
+"      <arg direction=\"in\" type=\"u\" name=\"handle_type\" />\n"
+"      <arg direction=\"in\" type=\"u\" name=\"handle\" />\n"
+"      <arg direction=\"in\" type=\"b\" name=\"suppress_handler\" />\n"
+"      <arg direction=\"out\" type=\"o\" />\n"
+"    </method>\n"
+"    <method name=\"RequestHandles\" >\n"
+"      <annotation value=\"QList&lt;uint>\" name=\"com.trolltech.QtDBus.QtTypeName.Out0\" />\n"
+"      <arg direction=\"in\" type=\"u\" name=\"handle_type\" />\n"
+"      <arg direction=\"in\" type=\"as\" name=\"names\" />\n"
+"      <arg direction=\"out\" type=\"au\" />\n"
+"    </method>\n"
+"    <signal name=\"NewChannel\" >\n"
+"      <arg type=\"o\" name=\"object_path\" />\n"
+"      <arg type=\"s\" name=\"channel_type\" />\n"
+"      <arg type=\"u\" name=\"handle_type\" />\n"
+"      <arg type=\"u\" name=\"handle\" />\n"
+"      <arg type=\"b\" name=\"suppress_handler\" />\n"
+"    </signal>\n"
+"    <signal name=\"StatusChanged\" >\n"
+"      <arg type=\"u\" name=\"status\" />\n"
+"      <arg type=\"u\" name=\"reason\" />\n"
+"    </signal>\n"
+"  </interface>\n"
+        "")
+public:
+    ConnectionAdaptor(QObject *parent);
+    virtual ~ConnectionAdaptor();
+
+public: // PROPERTIES
+    Q_PROPERTY(QStringList Interfaces READ Interfaces)
+    QStringList Interfaces() const;
+
+public Q_SLOTS: // METHODS
+    void Connect();
+    void Disconnect();
+    QStringList GetInterfaces();
+    QString GetProtocol();
+    uint GetSelfHandle();
+    uint GetStatus();
+    void HoldHandles(uint handle_type, const QList<uint> &handles);
+    QStringList InspectHandles(uint handle_type, const QList<uint> &handles);
+    org::freedesktop::Telepathy::ChannelInfoList ListChannels();
+    void ReleaseHandles(uint handle_type, const QList<uint> &handles);
+    QDBusObjectPath RequestChannel(const QString &type, uint handle_type, uint handle, bool suppress_handler);
+    QList<uint> RequestHandles(uint handle_type, const QStringList &names);
+Q_SIGNALS: // SIGNALS
+    void NewChannel(const QDBusObjectPath &object_path, const QString &channel_type, uint handle_type, uint handle, bool suppress_handler);
+    void StatusChanged(uint status, uint reason);
+};
+
+#endif
diff --git a/src/vicar-telepathy/src/connectioninterfacecapabilitiesadaptor.cpp b/src/vicar-telepathy/src/connectioninterfacecapabilitiesadaptor.cpp
new file mode 100644 (file)
index 0000000..7cb1780
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -i connectioninterfacecapabilitiestypes.h -c ConnectionInterfaceCapabilitiesAdaptor -a connectioninterfacecapabilitiesadaptor.h:connectioninterfacecapabilitiesadaptor.cpp data/xml/org.freedesktop.Telepathy.Connection.I.Capabilities.xml
+ *
+ * qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#include "connectioninterfacecapabilitiesadaptor.h"
+#include <QtCore/QMetaObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+
+/*
+ * Implementation of adaptor class ConnectionInterfaceCapabilitiesAdaptor
+ */
+
+ConnectionInterfaceCapabilitiesAdaptor::ConnectionInterfaceCapabilitiesAdaptor(QObject *parent)
+    : QDBusAbstractAdaptor(parent)
+{
+    // constructor
+    setAutoRelaySignals(true);
+}
+
+ConnectionInterfaceCapabilitiesAdaptor::~ConnectionInterfaceCapabilitiesAdaptor()
+{
+    // destructor
+}
+
+org::freedesktop::Telepathy::CapabilityPairList ConnectionInterfaceCapabilitiesAdaptor::AdvertiseCapabilities(org::freedesktop::Telepathy::CapabilityPairList Add, const QStringList &Remove)
+{
+    // handle method call org.freedesktop.Telepathy.Connection.Interface.Capabilities.AdvertiseCapabilities
+    org::freedesktop::Telepathy::CapabilityPairList Self_Capabilities;
+    QMetaObject::invokeMethod(parent(), "AdvertiseCapabilities", Q_RETURN_ARG(org::freedesktop::Telepathy::CapabilityPairList, Self_Capabilities), Q_ARG(org::freedesktop::Telepathy::CapabilityPairList, Add), Q_ARG(QStringList, Remove));
+    return Self_Capabilities;
+}
+
+org::freedesktop::Telepathy::ContactCapabilitiesList ConnectionInterfaceCapabilitiesAdaptor::GetCapabilities(const QList<uint> &Handles)
+{
+    // handle method call org.freedesktop.Telepathy.Connection.Interface.Capabilities.GetCapabilities
+    org::freedesktop::Telepathy::ContactCapabilitiesList Contact_Capabilities;
+    QMetaObject::invokeMethod(parent(), "GetCapabilities", Q_RETURN_ARG(org::freedesktop::Telepathy::ContactCapabilitiesList, Contact_Capabilities), Q_ARG(QList<uint>, Handles));
+    return Contact_Capabilities;
+}
+
diff --git a/src/vicar-telepathy/src/connectioninterfacecapabilitiesadaptor.h b/src/vicar-telepathy/src/connectioninterfacecapabilitiesadaptor.h
new file mode 100644 (file)
index 0000000..c891276
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -i connectioninterfacecapabilitiestypes.h -c ConnectionInterfaceCapabilitiesAdaptor -a connectioninterfacecapabilitiesadaptor.h:connectioninterfacecapabilitiesadaptor.cpp data/xml/org.freedesktop.Telepathy.Connection.I.Capabilities.xml
+ *
+ * qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#ifndef CONNECTIONINTERFACECAPABILITIESADAPTOR_H_1282518435
+#define CONNECTIONINTERFACECAPABILITIESADAPTOR_H_1282518435
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+#include "connectioninterfacecapabilitiestypes.h"
+class QByteArray;
+template<class T> class QList;
+template<class Key, class Value> class QMap;
+class QString;
+class QStringList;
+class QVariant;
+
+/*
+ * Adaptor class for interface org.freedesktop.Telepathy.Connection.Interface.Capabilities
+ */
+class ConnectionInterfaceCapabilitiesAdaptor: public QDBusAbstractAdaptor
+{
+    Q_OBJECT
+    Q_CLASSINFO("D-Bus Interface", "org.freedesktop.Telepathy.Connection.Interface.Capabilities")
+    Q_CLASSINFO("D-Bus Introspection", ""
+"  <interface name=\"org.freedesktop.Telepathy.Connection.Interface.Capabilities\">\n"
+"    <method name=\"GetCapabilities\">\n"
+"      <annotation value=\"QList&lt;uint>\" name=\"com.trolltech.QtDBus.QtTypeName.In0\"/>\n"
+"      <annotation value=\"org::freedesktop::Telepathy::ContactCapabilitiesList\" name=\"com.trolltech.QtDBus.QtTypeName.Out0\"/>\n"
+"      <arg direction=\"in\" type=\"au\" name=\"Handles\"/>\n"
+"      <arg direction=\"out\" type=\"a(usuu)\" name=\"Contact_Capabilities\"/>\n"
+"    </method>\n"
+"    <method name=\"AdvertiseCapabilities\">\n"
+"      <annotation value=\"org::freedesktop::Telepathy::CapabilityPairList\" name=\"com.trolltech.QtDBus.QtTypeName.In0\"/>\n"
+"      <annotation value=\"org::freedesktop::Telepathy::CapabilityPairList\" name=\"com.trolltech.QtDBus.QtTypeName.Out0\"/>\n"
+"      <arg direction=\"in\" type=\"a(su)\" name=\"Add\"/>\n"
+"      <arg direction=\"in\" type=\"as\" name=\"Remove\"/>\n"
+"      <arg direction=\"out\" type=\"a(su)\" name=\"Self_Capabilities\"/>\n"
+"    </method>\n"
+"    <signal name=\"CapabilitiesChanged\">\n"
+"      <annotation value=\"org::freedesktop::Telepathy::CapabilityChangeList\" name=\"com.trolltech.QtDBus.QtTypeName.In0\"/>\n"
+"      <arg type=\"a(usuuuu)\"/>\n"
+"    </signal>\n"
+"  </interface>\n"
+        "")
+public:
+    ConnectionInterfaceCapabilitiesAdaptor(QObject *parent);
+    virtual ~ConnectionInterfaceCapabilitiesAdaptor();
+
+public: // PROPERTIES
+public Q_SLOTS: // METHODS
+    org::freedesktop::Telepathy::CapabilityPairList AdvertiseCapabilities(org::freedesktop::Telepathy::CapabilityPairList Add, const QStringList &Remove);
+    org::freedesktop::Telepathy::ContactCapabilitiesList GetCapabilities(const QList<uint> &Handles);
+Q_SIGNALS: // SIGNALS
+    void CapabilitiesChanged(org::freedesktop::Telepathy::CapabilityChangeList in0);
+};
+
+#endif
diff --git a/src/vicar-telepathy/src/connectioninterfacecapabilitiestypes.cpp b/src/vicar-telepathy/src/connectioninterfacecapabilitiestypes.cpp
new file mode 100644 (file)
index 0000000..c3a2410
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+
+Based on QtTelepathy with copyright notice below.
+*/
+
+/*
+ * QtTelepathy, the Tapioca Qt4 Telepathy Client Library
+ * Copyright (C) 2006 by INdT
+ *  @author Andre Moreira Magalhaes <andre.magalhaes@indt.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "connectioninterfacecapabilitiestypes.h"
+
+using namespace org::freedesktop::Telepathy;
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, ContactCapabilities &val)
+{
+    argument.beginStructure();
+    argument >> val.handle >> val.channelType >> val.genericCapabilityFlags >> val.typeSpecificFlags;
+    argument.endStructure();
+    return argument;
+}
+
+QDBusArgument &operator<<(QDBusArgument &argument, const ContactCapabilities &val)
+{
+    argument.beginStructure();
+    argument << val.handle << val.channelType << val.genericCapabilityFlags << val.typeSpecificFlags;
+    argument.endStructure();
+    return argument;
+}
+
+QDebug &operator<<(QDebug arg,const ContactCapabilities &val)
+{
+    arg.space() << "[" << val.handle << "," << val.channelType << "," <<  val.genericCapabilityFlags << "," <<  val.typeSpecificFlags << "]";
+    return arg.space();
+}
+
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, CapabilityPair &val)
+{
+    argument.beginStructure();
+    argument >> val.channelType >> val.typeSpecificFlags;
+    argument.endStructure();
+    return argument;
+}
+
+QDBusArgument &operator<<(QDBusArgument &argument, const CapabilityPair &val)
+{
+    argument.beginStructure();
+    argument << val.channelType << val.typeSpecificFlags;
+    argument.endStructure();
+    return argument;
+}
+
+QDebug &operator<<(QDebug arg,const CapabilityPair &val)
+{
+    arg.space() << "[" << val.channelType << "," <<  val.typeSpecificFlags << "]";
+    return arg.space();
+}
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, CapabilityChange &val)
+{
+    argument.beginStructure();
+    argument >> val.handle >> val.channelType >> val.oldGenericFlags >> val.newGenericFlags >> val.oldTypeSpecificFlags >> val.newTypeSpecificFlags;
+    argument.endStructure();
+    return argument;
+}
+
+QDBusArgument &operator<<(QDBusArgument &argument, const CapabilityChange &val)
+{
+    argument.beginStructure();
+    argument << val.handle << val.channelType << val.oldGenericFlags << val.newGenericFlags << val.oldTypeSpecificFlags << val.newTypeSpecificFlags;
+    argument.endStructure();
+    return argument;
+}
+
+QDebug &operator<<(QDebug arg,const CapabilityChange &val)
+{
+    arg.space() << "[" << val.handle << "," << val.channelType << "," <<  val.oldGenericFlags << "," <<  val.newGenericFlags << "," <<  val.oldTypeSpecificFlags << "," <<  val.newTypeSpecificFlags << "]";
+    return arg.space();
+}
diff --git a/src/vicar-telepathy/src/connectioninterfacecapabilitiestypes.h b/src/vicar-telepathy/src/connectioninterfacecapabilitiestypes.h
new file mode 100644 (file)
index 0000000..21243eb
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+
+Based on QtTelepathy with copyright notice below.
+*/
+
+/*
+ * QtTelepathy, the Tapioca Qt4 Telepathy Client Library
+ * Copyright (C) 2006 by Tobias Hunger <tobias.hunger@basyskom.de>
+ * Copyright (C) 2006 by INdT
+ *  @author Andre Moreira Magalhaes <andre.magalhaes@indt.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef CONNECTIONINTERFACECAPABILITIESTYPES_H
+#define CONNECTIONINTERFACECAPABILITIESTYPES_H
+
+#include <QtCore/QList>
+#include <QtCore/QDebug>
+#include <QtCore/QVariantMap>
+#include <QtDBus/QDBusArgument>
+#include <QtDBus/QDBusObjectPath>
+
+namespace org {
+namespace freedesktop {
+namespace Telepathy {
+
+class ContactCapabilities
+{
+public:
+    uint handle;
+    QString channelType;
+    uint genericCapabilityFlags;
+    uint typeSpecificFlags;
+};
+typedef QList<ContactCapabilities> ContactCapabilitiesList;
+
+class CapabilityPair
+{
+public:
+    QString channelType;
+    uint typeSpecificFlags;
+};
+typedef QList<CapabilityPair> CapabilityPairList;
+
+class CapabilityChange
+{
+public:
+    uint handle;
+    QString channelType;
+    uint oldGenericFlags;
+    uint newGenericFlags;
+    uint oldTypeSpecificFlags;
+    uint newTypeSpecificFlags;
+};
+typedef QList<CapabilityChange> CapabilityChangeList;
+
+} // namespace Telepathy
+} // namespace freedesktop
+} // namespace org
+
+Q_DECLARE_METATYPE(org::freedesktop::Telepathy::ContactCapabilities)
+Q_DECLARE_METATYPE(org::freedesktop::Telepathy::ContactCapabilitiesList)
+
+const QDBusArgument& operator>>(const QDBusArgument& arg, org::freedesktop::Telepathy::ContactCapabilities& val);
+QDBusArgument& operator<<(QDBusArgument& arg, const org::freedesktop::Telepathy::ContactCapabilities& val);
+QDebug& operator<<(QDebug arg, const org::freedesktop::Telepathy::ContactCapabilities& val);
+
+Q_DECLARE_METATYPE(org::freedesktop::Telepathy::CapabilityPair)
+Q_DECLARE_METATYPE(org::freedesktop::Telepathy::CapabilityPairList)
+
+const QDBusArgument& operator>>(const QDBusArgument& arg, org::freedesktop::Telepathy::CapabilityPair& val);
+QDBusArgument& operator<<(QDBusArgument& arg, const org::freedesktop::Telepathy::CapabilityPair& val);
+QDebug& operator<<(QDebug arg, const org::freedesktop::Telepathy::CapabilityPair& val);
+
+Q_DECLARE_METATYPE(org::freedesktop::Telepathy::CapabilityChange)
+Q_DECLARE_METATYPE(org::freedesktop::Telepathy::CapabilityChangeList)
+
+const QDBusArgument& operator>>(const QDBusArgument& arg, org::freedesktop::Telepathy::CapabilityChange& val);
+QDBusArgument& operator<<(QDBusArgument& arg, const org::freedesktop::Telepathy::CapabilityChange& val);
+QDebug& operator<<(QDebug arg, const org::freedesktop::Telepathy::CapabilityChange& val);
+
+#endif // CONNECTIONINTERFACECAPABILITIESTYPES_H
diff --git a/src/vicar-telepathy/src/connectioninterfacerequestsadaptor.cpp b/src/vicar-telepathy/src/connectioninterfacerequestsadaptor.cpp
new file mode 100644 (file)
index 0000000..6f4459c
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -i connectioninterfacerequeststypes.h -c ConnectionInterfaceRequestsAdaptor -a src/connectioninterfacerequestsadaptor.h:src/connectioninterfacerequestsadaptor.cpp data/Conn.I.Requests.xml
+ *
+ * qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Hand Edited! Do not re-generate
+ */
+
+#include "connectioninterfacerequestsadaptor.h"
+#include "connectioninterfacerequeststypes.h"
+#include "connection.h"
+#include <QtCore/QMetaObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+
+/*
+ * Implementation of adaptor class ConnectionInterfaceRequestsAdaptor
+ */
+
+ConnectionInterfaceRequestsAdaptor::ConnectionInterfaceRequestsAdaptor(QObject *parent)
+    : QDBusAbstractAdaptor(parent)
+{
+    // constructor
+    setAutoRelaySignals(true);
+}
+
+ConnectionInterfaceRequestsAdaptor::~ConnectionInterfaceRequestsAdaptor()
+{
+    // destructor
+}
+
+org::freedesktop::Telepathy::RequestableChannelClassList ConnectionInterfaceRequestsAdaptor::requestableChannelClasses() const
+{
+    // get the value of property RequestableChannelClasses
+    return qvariant_cast< org::freedesktop::Telepathy::RequestableChannelClassList >(parent()->property("RequestableChannelClasses"));
+}
+
+
+QDBusObjectPath ConnectionInterfaceRequestsAdaptor::CreateChannel(const QVariantMap &request, QVariantMap &channel_properties)
+{
+    // handle method call org.freedesktop.Telepathy.Connection.Interface.Requests.CreateChannel
+    return static_cast<Connection *>(parent())->CreateChannel(request, channel_properties);
+}
+
+bool ConnectionInterfaceRequestsAdaptor::EnsureChannel(const QVariantMap &request, QDBusObjectPath &channel_object, QVariantMap &channel_properties)
+{
+    // handle method call org.freedesktop.Telepathy.Connection.Interface.Requests.EnsureChannel
+    return static_cast<Connection *>(parent())->EnsureChannel(request, channel_object, channel_properties);
+}
+
diff --git a/src/vicar-telepathy/src/connectioninterfacerequestsadaptor.h b/src/vicar-telepathy/src/connectioninterfacerequestsadaptor.h
new file mode 100644 (file)
index 0000000..527e7f8
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -i connectioninterfacerequeststypes.h -c ConnectionInterfaceRequestsAdaptor -a src/connectioninterfacerequestsadaptor.h:src/connectioninterfacerequestsadaptor.cpp data/Conn.I.Requests.xml
+ *
+ * qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#ifndef CONNECTIONINTERFACEREQUESTSADAPTOR_H_1280083803
+#define CONNECTIONINTERFACEREQUESTSADAPTOR_H_1280083803
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+#include "connectioninterfacerequeststypes.h"
+class QByteArray;
+template<class T> class QList;
+template<class Key, class Value> class QMap;
+class QString;
+class QStringList;
+class QVariant;
+//class org::freedesktop::Telepathy::RequestableChannelClass;
+//class org::freedesktop::Telepathy::RequestableChannelClassList;
+
+/*
+ * Adaptor class for interface org.freedesktop.Telepathy.Connection.Interface.Requests
+ */
+class ConnectionInterfaceRequestsAdaptor: public QDBusAbstractAdaptor
+{
+    Q_OBJECT
+    Q_CLASSINFO("D-Bus Interface", "org.freedesktop.Telepathy.Connection.Interface.Requests")
+    Q_CLASSINFO("D-Bus Introspection", ""
+                "  <interface name=\"org.freedesktop.Telepathy.Connection.Interface.Requests\">\n"
+                "    <property access=\"read\" type=\"(a{sv}as)\" name=\"RequestableChannelClasses\">\n"
+                "      <annotation value=\"org::freedesktop::Telepathy::RequestableChannelClassList\" name=\"com.trolltech.QtDBus.QtTypeName\"/>\n"
+                "    </property>\n"
+                "    <method name=\"CreateChannel\">\n"
+                "      <annotation value=\"QVariantMap\" name=\"com.trolltech.QtDBus.QtTypeName.In0\"/>\n"
+                "      <annotation value=\"QVariantMap\" name=\"com.trolltech.QtDBus.QtTypeName.Out1\"/>\n"
+                "      <arg direction=\"in\" type=\"a{sv}\" name=\"request\"/>\n"
+                "      <arg direction=\"out\" type=\"o\" name=\"channel_object\"/>\n"
+                "      <arg direction=\"out\" type=\"a{sv}\" name=\"channel_properties\"/>\n"
+                "    </method>\n"
+                "    <method name=\"EnsureChannel\">\n"
+                "      <annotation value=\"QVariantMap\" name=\"com.trolltech.QtDBus.QtTypeName.In0\"/>\n"
+                "      <annotation value=\"QVariantMap\" name=\"com.trolltech.QtDBus.QtTypeName.Out2\"/>\n"
+                "      <arg direction=\"in\" type=\"a{sv}\" name=\"request\"/>\n"
+                "      <arg direction=\"out\" type=\"b\" name=\"yours\"/>\n"
+                "      <arg direction=\"out\" type=\"o\" name=\"channel_object\"/>\n"
+                "      <arg direction=\"out\" type=\"a{sv}\" name=\"channel_properties\"/>\n"
+                "    </method>\n"
+                "    <signal name=\"NewChannels\">\n"
+                "      <annotation value=\"org::freedesktop::Telepathy::ChannelDetailsList\" name=\"com.trolltech.QtDBus.QtTypeName.In0\"/>\n"
+                "      <arg type=\"a(oa{sv})\" name=\"new_channels\"/>\n"
+                "    </signal>\n"
+                "    <signal name=\"ChannelClosed\">\n"
+                "      <arg type=\"o\" name=\"removed_channel_object\"/>\n"
+                "    </signal>\n"
+                "  </interface>\n"
+                        "")
+public:
+    ConnectionInterfaceRequestsAdaptor(QObject *parent);
+    virtual ~ConnectionInterfaceRequestsAdaptor();
+
+public: // PROPERTIES    
+    Q_PROPERTY(org::freedesktop::Telepathy::RequestableChannelClassList RequestableChannelClasses READ requestableChannelClasses)
+    org::freedesktop::Telepathy::RequestableChannelClassList requestableChannelClasses() const;
+
+public Q_SLOTS: // METHODS
+    QDBusObjectPath CreateChannel(const QVariantMap &request, QVariantMap &channel_properties);
+    bool EnsureChannel(const QVariantMap &request, QDBusObjectPath &channel_object, QVariantMap &channel_properties);
+Q_SIGNALS: // SIGNALS
+    void ChannelClosed(const QDBusObjectPath &removed_channel_object);
+    void NewChannels(org::freedesktop::Telepathy::ChannelDetailsList new_channels);
+};
+
+#endif
diff --git a/src/vicar-telepathy/src/connectioninterfacerequeststypes.cpp b/src/vicar-telepathy/src/connectioninterfacerequeststypes.cpp
new file mode 100644 (file)
index 0000000..33ea4a6
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+
+Based on QtTelepathy with copyright notice below.
+*/
+
+/*
+ * QtTelepathy, the Tapioca Qt4 Telepathy Client Library
+ * Copyright (C) 2006 by INdT
+ *  @author Andre Moreira Magalhaes <andre.magalhaes@indt.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "connectioninterfacerequeststypes.h"
+
+using namespace org::freedesktop::Telepathy;
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, ChannelDetails &val)
+{
+    argument.beginStructure();
+    argument >> val.channel >> val.properties;
+    argument.endStructure();
+    return argument;
+}
+
+QDBusArgument &operator<<(QDBusArgument &argument, const ChannelDetails &val)
+{
+    argument.beginStructure();
+    argument << val.channel << val.properties;
+    argument.endStructure();
+    return argument;
+}
+
+QDebug &operator<<(QDebug arg,const ChannelDetails &val)
+{
+    arg.space() << "[" << val.channel.path() << "," << val.properties <<"]";
+    return arg.space();
+}
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, RequestableChannelClass &val)
+{
+    argument.beginStructure();
+    argument >> val.fixedProperties >> val.allowedProperties;
+    argument.endStructure();
+    return argument;
+}
+
+QDBusArgument &operator<<(QDBusArgument &argument, const RequestableChannelClass &val)
+{
+    argument.beginStructure();
+    argument << val.fixedProperties << val.allowedProperties;
+    argument.endStructure();
+    return argument;
+}
+
+QDebug &operator<<(QDebug arg,const RequestableChannelClass &val)
+{
+    arg.space() << "[" << val.fixedProperties << "," << val.allowedProperties <<"]";
+    return arg.space();
+}
diff --git a/src/vicar-telepathy/src/connectioninterfacerequeststypes.h b/src/vicar-telepathy/src/connectioninterfacerequeststypes.h
new file mode 100644 (file)
index 0000000..2b6c884
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+
+Based on QtTelepathy with copyright notice below.
+*/
+
+/*
+ * QtTelepathy, the Tapioca Qt4 Telepathy Client Library
+ * Copyright (C) 2006 by Tobias Hunger <tobias.hunger@basyskom.de>
+ * Copyright (C) 2006 by INdT
+ *  @author Andre Moreira Magalhaes <andre.magalhaes@indt.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef QTTELEPATHY_CONNECTIONINTERFACEREQUESTSTYPES_H
+#define QTTELEPATHY_CONNECTIONINTERFACEREQUESTSTYPES_H
+
+#include <QtCore/QList>
+#include <QtCore/QDebug>
+#include <QtCore/QVariantMap>
+#include <QtDBus/QDBusArgument>
+#include <QtDBus/QDBusObjectPath>
+
+namespace org {
+namespace freedesktop {
+namespace Telepathy {
+
+class ChannelDetails
+{
+public:
+    QDBusObjectPath channel;
+    QVariantMap properties;
+};
+typedef QList<ChannelDetails> ChannelDetailsList;
+
+class RequestableChannelClass
+{
+public:
+    QVariantMap fixedProperties;
+    QStringList allowedProperties;
+};
+typedef QList<RequestableChannelClass> RequestableChannelClassList;
+
+} // namespace Telepathy
+} // namespace freedesktop
+} // namespace org
+
+Q_DECLARE_METATYPE(org::freedesktop::Telepathy::ChannelDetails)
+Q_DECLARE_METATYPE(org::freedesktop::Telepathy::ChannelDetailsList)
+
+const QDBusArgument& operator>>(const QDBusArgument& arg, org::freedesktop::Telepathy::ChannelDetails& val);
+QDBusArgument& operator<<(QDBusArgument& arg, const org::freedesktop::Telepathy::ChannelDetails& val);
+QDebug& operator<<(QDebug arg, const org::freedesktop::Telepathy::ChannelDetails& val);
+
+Q_DECLARE_METATYPE(org::freedesktop::Telepathy::RequestableChannelClass)
+Q_DECLARE_METATYPE(org::freedesktop::Telepathy::RequestableChannelClassList)
+
+const QDBusArgument& operator>>(const QDBusArgument& arg, org::freedesktop::Telepathy::RequestableChannelClass& val);
+QDBusArgument& operator<<(QDBusArgument& arg, const org::freedesktop::Telepathy::RequestableChannelClass& val);
+QDebug& operator<<(QDebug arg, const org::freedesktop::Telepathy::RequestableChannelClass& val);
+
+#endif
+
diff --git a/src/vicar-telepathy/src/connectionmanager.cpp b/src/vicar-telepathy/src/connectionmanager.cpp
new file mode 100644 (file)
index 0000000..1a89778
--- /dev/null
@@ -0,0 +1,187 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+
+Based on Telepathy-SNOM with copyright notice below.
+*/
+
+/*
+ * Telepathy SNOM VoIP phone connection manager
+ * Copyright (C) 2006 by basyskom GmbH
+ *  @author Tobias Hunger <info@basyskom.de>
+ *
+ * This library is free software; you can redisQObject::tribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is disQObject::tributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin SQObject::treet, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "connectionmanager.h"
+#include "connectionmanageradaptor.h"
+#include "connection.h"
+
+#include <QtCore/QDebug>
+
+namespace
+{
+static const QString protocol_name("tel");
+}
+
+class ConnectionManagerPrivate
+{
+public:
+    ConnectionManagerPrivate(ConnectionManager * parent) :
+        adaptor(new ConnectionManagerAdaptor(parent))
+    { Q_ASSERT(0 != adaptor); }
+
+    ~ConnectionManagerPrivate() { delete(adaptor);}
+
+    ConnectionManagerAdaptor * const adaptor;
+};
+
+// ---------------------------------------------------------------------------
+
+ConnectionManager::ConnectionManager(QObject * parent) :
+    QObject(parent),
+    d(new ConnectionManagerPrivate(this))
+{ Q_ASSERT(0 != d); }
+
+ConnectionManager::~ConnectionManager()
+{ delete(d); }
+
+org::freedesktop::Telepathy::ParameterDefinitionList
+ConnectionManager::GetParameters(const QString &proto)
+{
+    Q_ASSERT(!proto.isEmpty());
+    qDebug() << "VICAR: ConnectionManager::GetParameters(const QString &prot)";
+    org::freedesktop::Telepathy::ParameterDefinitionList result;
+    org::freedesktop::Telepathy::ParameterDefinition param;
+
+    // Attention! Default constructed QDBusVariants cause havok on the D-Bus!
+    param.name = "com.nokia.Telepathy.Connection.Interface.GSM.IMSI";
+    param.flags = Register;
+    param.signature = "s";
+    //param.defaultValue = QDBusVariant(QString());
+    result.append(param);
+
+    param.name = "com.nokia.Telepathy.Connection.Interface.GSM.Privacy";
+    param.flags = Register|hasDefault;
+    param.signature = "s";
+    param.defaultValue = QDBusVariant(QString());
+    result.append(param);
+
+    param.name = "com.nokia.Telepathy.Connection.Interface.GSM.SMSServiceCentre";
+    param.flags = Register;
+    param.signature = "s";
+    //param.defaultValue = QDBusVariant(QString());
+    result.append(param);
+
+    param.name = "com.nokia.Telepathy.Connection.Interface.GSM.SMSValidityPeriod";
+    param.flags = Register|hasDefault;
+    param.signature = "u";
+    param.defaultValue = QDBusVariant(0);
+    result.append(param);
+
+    param.name = "account";
+    param.flags = None;
+    param.signature = "s";
+    //param.defaultValue = QDBusVariant(QString());
+    result.append(param);
+
+    param.name = "password";
+    param.flags = None;
+    param.signature = "s";
+    //param.defaultValue = QDBusVariant(QString());
+    result.append(param);
+
+    return result;
+}
+
+QStringList ConnectionManager::ListProtocols()
+{
+    qDebug() << "VICaR ConnectionManager::ListProtocols()";
+    return QStringList(protocol_name);
+}
+
+QString ConnectionManager::RequestConnection(const QString & proto,
+                                             QVariantMap parameters,
+                                             QDBusObjectPath & object_path)
+{
+    qDebug() << "VICaR CM: Connection Requested...";
+    QString connection_service;
+    object_path = QDBusObjectPath();
+
+    if (proto != protocol_name)
+    {
+        /*
+        sendErrorReply("org.freedesktop.Telepathy.Error.NotImplemented",
+                       "VICaR - Unable to create Connection. Requested protocol is not implemented.");
+        */
+        qDebug() << "VICaR CM::RequestConnection: proto mismatch.";
+        return connection_service;
+    }
+
+
+    QString imsi;
+    QString privacy;
+    QString smsServiceCenter;
+    uint smsValidityPeriod(0);
+    QString account;
+    QString password;
+
+    // read parameters:
+    QString param;
+    foreach (param, parameters.keys())
+    {
+        if ("com.nokia.Telepathy.Connection.Interface.GSM.IMSI" == param)
+        { imsi = parameters[param].toString(); }
+        else if ("com.nokia.Telepathy.Connection.Interface.GSM.Privacy" == param)
+        { privacy = parameters[param].toString(); }
+        else if ("com.nokia.Telepathy.Connection.Interface.GSM.SMSServiceCentre" == param)
+        { smsServiceCenter = parameters[param].toString(); }
+        else if ("com.nokia.Telepathy.Connection.Interface.GSM.SMSValidityPeriod" == param)
+        { smsValidityPeriod = parameters[param].toInt(); }
+        else if ("account" == param)
+        { account = parameters[param].toString(); }
+        else if ("password" == param)
+        { password = parameters[param].toString(); }
+        else
+        {
+            /*
+            sendErrorReply("org.freedesktop.Telepathy.Error.InvalidArgument",
+                           "VICaR - Unable to create Connection. Invalid parameters specified.");
+            */
+            qDebug() << "VICaR CM::RequestConnection: invalid parameter" << param << "found.";
+            return connection_service;
+        }
+    }
+
+    Connection * new_connection = new Connection(account, this);
+    Q_ASSERT(0 != new_connection);
+
+    if (!new_connection->registerObject())
+    {
+        qDebug() << "VICaR CM: Error while registering Connection object with DBus.";
+        delete new_connection;
+        return QString();
+    }
+
+    qDebug() << "VICaR CM: New Connection Created. Status is "<< new_connection->GetStatus();
+
+    object_path = new_connection->objectPath();
+    connection_service = new_connection->serviceName();
+
+    emit NewConnection(connection_service, object_path, "tel");
+
+    return new_connection->serviceName();
+}
diff --git a/src/vicar-telepathy/src/connectionmanager.h b/src/vicar-telepathy/src/connectionmanager.h
new file mode 100644 (file)
index 0000000..bdb5049
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+
+Based on Telepathy-SNOM with copyright notice below.
+*/
+
+/*
+ * Telepathy SNOM VoIP phone connection manager
+ * Copyright (C) 2006 by basyskom GmbH
+ *  @author Tobias Hunger <info@basyskom.de>
+ *
+ * This library is free software; you can redisQObject::tribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is disQObject::tributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin SQObject::treet, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef _VICAR_CONNECTIONMANAGER_H_
+#define _VICAR_CONNECTIONMANAGER_H_
+
+#include "connectionmanagertypes.h"
+#include <QtDBus/QDBusContext>
+#include <QtDBus/QtDBus>
+
+class ConnectionManagerPrivate;
+
+class ConnectionManager : public QObject
+{
+    Q_OBJECT
+    Q_DECLARE_PRIVATE(ConnectionManager)
+
+public:
+    explicit ConnectionManager(QObject * parent = 0);
+    ~ConnectionManager();
+
+    enum ParamFlags
+    {
+        None = 0,
+        Required = 1,
+        Register = 2,
+        hasDefault = 4
+    };
+
+public slots:
+    org::freedesktop::Telepathy::ParameterDefinitionList
+    GetParameters(const QString &proto);
+
+    QStringList ListProtocols();
+
+    QString RequestConnection(const QString &proto, QVariantMap parameters,
+                              QDBusObjectPath &object_path);
+
+signals:
+    void NewConnection(const QString &bus_name,
+                       const QDBusObjectPath &object_path,
+                       const QString &proto);
+
+private:
+    ConnectionManager(const ConnectionManager &); // no impl.
+
+    ConnectionManagerPrivate * const d;
+};
+
+#endif
diff --git a/src/vicar-telepathy/src/connectionmanageradaptor.cpp b/src/vicar-telepathy/src/connectionmanageradaptor.cpp
new file mode 100644 (file)
index 0000000..d652985
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * This file was generated by dbusxml2cpp version 0.6
+ * Command line was: dbusxml2cpp -i QtTelepathy/Core/ConnectionManagerAdaptor -i QtTelepathy/Common/ConnectionManagerTypes -a :src/Core/connectionmanageradaptor.cpp xml/tp-connmgr.xml
+ *
+ * dbusxml2cpp is Copyright (C) 2006 Trolltech ASA. All rights reserved.
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+// EDITED FILE, DO NOT UPDATE!
+
+#include "connectionmanageradaptor.h"
+#include <QtCore/QMetaObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+#include <QtCore/QDebug>
+
+#include "connectionmanager.h"
+
+/*
+ * Implementation of adaptor class ConnectionManagerAdaptor
+ */
+
+ConnectionManagerAdaptor::ConnectionManagerAdaptor(QObject *parent)
+    : QDBusAbstractAdaptor(parent)
+{
+    // constructor
+    setAutoRelaySignals(true);
+}
+
+ConnectionManagerAdaptor::~ConnectionManagerAdaptor()
+{
+    // destructor
+}
+
+org::freedesktop::Telepathy::ParameterDefinitionList ConnectionManagerAdaptor::GetParameters(const QString &proto)
+{
+    // handle method call org.freedesktop.Telepathy.ConnectionManager.GetParameters
+    org::freedesktop::Telepathy::ParameterDefinitionList out0;
+    QMetaObject::invokeMethod(parent(), "GetParameters", Q_RETURN_ARG(org::freedesktop::Telepathy::ParameterDefinitionList, out0), Q_ARG(QString, proto));
+    return out0;
+}
+
+QStringList ConnectionManagerAdaptor::ListProtocols()
+{
+    // handle method call org.freedesktop.Telepathy.ConnectionManager.ListProtocols
+    QStringList out0;
+    QMetaObject::invokeMethod(parent(), "ListProtocols", Q_RETURN_ARG(QStringList, out0));
+    return out0;
+}
+
+QString ConnectionManagerAdaptor::RequestConnection(const QString &proto, QVariantMap parameters, QDBusObjectPath &object_path)
+{
+    // handle method call org.freedesktop.Telepathy.ConnectionManager.RequestConnection
+    return static_cast<ConnectionManager *>(parent())->RequestConnection(proto, parameters, object_path);
+}
+
diff --git a/src/vicar-telepathy/src/connectionmanageradaptor.h b/src/vicar-telepathy/src/connectionmanageradaptor.h
new file mode 100644 (file)
index 0000000..9d06b28
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * This file was generated by dbusxml2cpp version 0.6
+ * Command line was: dbusxml2cpp -i QtTelepathy/Common/BaseTypes -i QtTelepathy/Common/ConnectionManagerTypes -a include/QtTelepathy/Core/connectionmanageradaptor.h: xml/tp-connmgr.xml
+ *
+ * dbusxml2cpp is Copyright (C) 2006 Trolltech ASA. All rights reserved.
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#ifndef CONNECTIONMANAGERADAPTOR_H_1172489892
+#define CONNECTIONMANAGERADAPTOR_H_1172489892
+
+#include <QtCore/QObject>
+#include <QtDBus/QtDBus>
+#include "connectionmanagertypes.h"
+class QByteArray;
+template<class T> class QList;
+template<class Key, class Value> class QMap;
+class QString;
+class QStringList;
+class QVariant;
+
+/*
+ * Adaptor class for interface org.freedesktop.Telepathy.ConnectionManager
+ */
+class ConnectionManagerAdaptor: public QDBusAbstractAdaptor
+{
+    Q_OBJECT
+    Q_CLASSINFO("D-Bus Interface", "org.freedesktop.Telepathy.ConnectionManager")
+    Q_CLASSINFO("D-Bus Introspection", ""
+"  <interface name=\"org.freedesktop.Telepathy.ConnectionManager\" >\n"
+"    <method name=\"GetParameters\" >\n"
+"      <annotation value=\"org::freedesktop::Telepathy::ParameterDefinitionList\" name=\"com.trolltech.QtDBus.QtTypeName.Out0\" />\n"
+"      <arg direction=\"in\" type=\"s\" name=\"proto\" />\n"
+"      <arg direction=\"out\" type=\"a(susv)\" />\n"
+"    </method>\n"
+"    <method name=\"ListProtocols\" >\n"
+"      <arg direction=\"out\" type=\"as\" />\n"
+"    </method>\n"
+"    <method name=\"RequestConnection\" >\n"
+"      <annotation value=\"QVariantMap\" name=\"com.trolltech.QtDBus.QtTypeName.In1\" />\n"
+"      <arg direction=\"in\" type=\"s\" name=\"proto\" />\n"
+"      <arg direction=\"in\" type=\"a{sv}\" name=\"parameters\" />\n"
+"      <arg direction=\"out\" type=\"s\" name=\"bus_name\" />\n"
+"      <arg direction=\"out\" type=\"o\" name=\"object_path\" />\n"
+"    </method>\n"
+"    <signal name=\"NewConnection\" >\n"
+"      <arg type=\"s\" name=\"bus_name\" />\n"
+"      <arg type=\"o\" name=\"object_path\" />\n"
+"      <arg type=\"s\" name=\"proto\" />\n"
+"    </signal>\n"
+"  </interface>\n"
+        "")
+public:
+    ConnectionManagerAdaptor(QObject *parent);
+    virtual ~ConnectionManagerAdaptor();
+
+public: // PROPERTIES
+public Q_SLOTS: // METHODS
+    org::freedesktop::Telepathy::ParameterDefinitionList GetParameters(const QString &proto);
+    QStringList ListProtocols();
+    QString RequestConnection(const QString &proto, QVariantMap parameters, QDBusObjectPath &object_path);
+Q_SIGNALS: // SIGNALS
+    void NewConnection(const QString &bus_name, const QDBusObjectPath &object_path, const QString &proto);
+};
+
+#endif
diff --git a/src/vicar-telepathy/src/connectionmanagertypes.cpp b/src/vicar-telepathy/src/connectionmanagertypes.cpp
new file mode 100644 (file)
index 0000000..481c7f1
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+
+Based on QtTelepathy with copyright notice below.
+*/
+
+/*
+ * QtTelepathy, the Tapioca Qt4 Telepathy Client Library
+ * Copyright (C) 2006 by INdT
+ *  @author Andre Moreira Magalhaes <andre.magalhaes@indt.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "connectionmanagertypes.h"
+
+using namespace org::freedesktop::Telepathy;
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, ParameterDefinition &param)
+{
+    argument.beginStructure();
+    argument >> param.name >> param.flags >> param.signature >> param.defaultValue;
+    argument.endStructure();
+    return argument;
+}
+
+QDBusArgument &operator<<(QDBusArgument &argument, const ParameterDefinition &param)
+{
+    argument.beginStructure();
+    argument << param.name << param.flags << param.signature << param.defaultValue;
+    argument.endStructure();
+    return argument;
+}
+
diff --git a/src/vicar-telepathy/src/connectionmanagertypes.h b/src/vicar-telepathy/src/connectionmanagertypes.h
new file mode 100644 (file)
index 0000000..f1e1b8d
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+
+Based on QtTelepathy with copyright notice below.
+*/
+
+/*
+ * QtTelepathy, the Tapioca Qt4 Telepathy Client Library
+ * Copyright (C) 2006 by Tobias Hunger <tobias.hunger@basyskom.de>
+ * Copyright (C) 2006 by INdT
+ *  @author Andre Moreira Magalhaes <andre.magalhaes@indt.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef QTTELEPATHY_CONNECTIONMANAGERTYPES_H
+#define QTTELEPATHY_CONNECTIONMANAGERTYPES_H
+
+#include <QtCore/QFlag>
+#include <QtCore/QList>
+#include <QtCore/QString>
+#include <QtDBus/QDBusArgument>
+#include <QtDBus/QDBusVariant>
+
+namespace org {
+namespace freedesktop {
+namespace Telepathy {
+
+class ParameterDefinition
+{
+public:
+    QString name;
+    uint flags;
+    QString signature;
+    QDBusVariant defaultValue;
+};
+typedef QList<ParameterDefinition> ParameterDefinitionList;
+
+} // namespace Telepathy
+} // namespace freedesktop
+} // namespace org
+
+Q_DECLARE_METATYPE(org::freedesktop::Telepathy::ParameterDefinition)
+Q_DECLARE_METATYPE(org::freedesktop::Telepathy::ParameterDefinitionList)
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, org::freedesktop::Telepathy::ParameterDefinition &param);
+QDBusArgument &operator<<(QDBusArgument &argument, const org::freedesktop::Telepathy::ParameterDefinition &param);
+
+#endif
+
diff --git a/src/vicar-telepathy/src/connectiontypes.cpp b/src/vicar-telepathy/src/connectiontypes.cpp
new file mode 100644 (file)
index 0000000..9632489
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+
+Based on QtTelepathy with copyright notice below.
+*/
+
+/*
+ * QtTelepathy, the Tapioca Qt4 Telepathy Client Library
+ * Copyright (C) 2006 by INdT
+ *  @author Andre Moreira Magalhaes <andre.magalhaes@indt.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "connectiontypes.h"
+
+using namespace org::freedesktop::Telepathy;
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, ChannelInfo &info)
+{
+    argument.beginStructure();
+    argument >> info.objectPath >> info.interfaceName >> info.handleType >> info.handle;
+    argument.endStructure();
+    return argument;
+}
+
+QDBusArgument &operator<<(QDBusArgument &argument, const ChannelInfo &info)
+{
+    argument.beginStructure();
+    argument << info.objectPath << info.interfaceName << info.handleType << info.handle;
+    argument.endStructure();
+    return argument;
+}
+
diff --git a/src/vicar-telepathy/src/connectiontypes.h b/src/vicar-telepathy/src/connectiontypes.h
new file mode 100644 (file)
index 0000000..9901510
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+
+Based on QtTelepathy with copyright notice below.
+*/
+
+/*
+ * QtTelepathy, the Tapioca Qt4 Telepathy Client Library
+ * Copyright (C) 2006 by Tobias Hunger <tobias.hunger@basyskom.de>
+ * Copyright (C) 2006 by INdT
+ *  @author Andre Moreira Magalhaes <andre.magalhaes@indt.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef QTTELEPATHY_CONNECTION_H
+#define QTTELEPATHY_CONNECTION_H
+
+#include <QtCore/QList>
+#include <QtCore/QString>
+#include <QtDBus/QDBusArgument>
+#include "basetypes.h"
+
+namespace org {
+namespace freedesktop {
+namespace Telepathy {
+
+enum HandleType {
+    HANDLE_TYPE_NONE = 0,
+    HANDLE_TYPE_CONTACT,
+    HANDLE_TYPE_ROOM,
+    HANDLE_TYPE_LIST
+};
+
+enum ConnectionState {
+    CONNECTION_STATUS_CONNECTED,
+    CONNECTION_STATUS_CONNECTING,
+    CONNECTION_STATUS_DISCONNECTED
+};
+
+enum ConnectionStateReason {
+    CONNECTION_STATUS_REASON_NONE_SPECIFIED,
+    CONNECTION_STATUS_REASON_REQUESTED,
+    CONNECTION_STATUS_REASON_NETWORK_ERROR,
+    CONNECTION_STATUS_REASON_AUTHENTICATION_FAILED,
+    CONNECTION_STATUS_REASON_ENCRYPTION_ERROR,
+    CONNECTION_STATUS_REASON_NAME_IN_USE,
+    CONNECTION_STATUS_REASON_CERT_NOT_PROVIDED,
+    CONNECTION_STATUS_REASON_CERT_UNTRUSTED,
+    CONNECTION_STATUS_REASON_CERT_EXPIRED,
+    CONNECTION_STATUS_REASON_CERT_NOT_ACTIVATED,
+    CONNECTION_STATUS_REASON_CERT_HOSTNAME_MISMATCH,
+    CONNECTION_STATUS_REASON_CERT_FINGERPRINT_MISMATCH,
+    CONNECTION_STATUS_REASON_CERT_SELF_SIGNED,
+    CONNECTION_STATUS_REASON_CERT_OTHER_ERROR
+};
+
+class ChannelInfo
+{
+public:
+    QDBusObjectPath objectPath;
+    QString interfaceName;
+    uint handleType;
+    uint handle;
+};
+typedef QList<ChannelInfo> ChannelInfoList;
+
+} // namespace Telepathy
+} // namespace freedesktop
+} // namespace org
+
+Q_DECLARE_METATYPE(org::freedesktop::Telepathy::ChannelInfo)
+Q_DECLARE_METATYPE(org::freedesktop::Telepathy::ChannelInfoList)
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, org::freedesktop::Telepathy::ChannelInfo &info);
+QDBusArgument &operator<<(QDBusArgument &argument, const org::freedesktop::Telepathy::ChannelInfo &info);
+
+#endif
+
diff --git a/src/vicar-telepathy/src/main.cpp b/src/vicar-telepathy/src/main.cpp
new file mode 100644 (file)
index 0000000..7ed93eb
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+
+Based on Telepathy-SNOM with copyright notice below.
+*/
+
+/*
+ * Telepathy SNOM VoIP phone connection manager
+ * Copyright (C) 2006 by basyskom GmbH
+ *  @author Tobias Hunger <info@basyskom.de>
+ *
+ * This library is free software; you can redisQObject::tribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is disQObject::tributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin SQObject::treet, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <iostream>
+#include <fstream>
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QDebug>
+
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusMetaType>
+#include <QtDBus/QDBusInterface>
+#include <QDateTime>
+
+#include "names.h"
+#include "connectionmanager.h"
+#include "basetypes.h"
+#include "connectionmanagertypes.h"
+#include "connectiontypes.h"
+#include "connectioninterfacerequeststypes.h"
+#include "connectioninterfacecapabilitiestypes.h"
+
+
+using namespace std;
+
+ofstream logfile;
+
+void MyOutputHandler(QtMsgType type, const char *msg) {
+    switch (type) {
+        case QtDebugMsg:
+            logfile << QTime::currentTime().toString().toAscii().data() << " Debug: " << msg << "\n";
+            break;
+        case QtCriticalMsg:
+            logfile << QTime::currentTime().toString().toAscii().data() << " Critical: " << msg << "\n";
+            break;
+        case QtWarningMsg:
+            logfile << QTime::currentTime().toString().toAscii().data() << " Warning: " << msg << "\n";
+            break;
+        case QtFatalMsg:
+            logfile << QTime::currentTime().toString().toAscii().data() <<  " Fatal: " << msg << "\n";
+            abort();
+    }
+}
+
+int main(int argc, char ** argv)
+{
+
+//    logfile.open("/var/log/logfile.txt", ios::app);
+//    #ifndef QT_NO_DEBUG_OUTPUT
+//    qInstallMsgHandler(MyOutputHandler);
+//    #endif
+
+
+    QCoreApplication app(argc, argv);
+
+    // register types:
+    qDBusRegisterMetaType<org::freedesktop::Telepathy::ParameterDefinition>();
+    qDBusRegisterMetaType<org::freedesktop::Telepathy::ParameterDefinitionList>();
+    qDBusRegisterMetaType<org::freedesktop::Telepathy::ChannelInfo>();
+    qDBusRegisterMetaType<org::freedesktop::Telepathy::ChannelInfoList>();
+    qDBusRegisterMetaType<org::freedesktop::Telepathy::ChannelDetails>();
+    qDBusRegisterMetaType<org::freedesktop::Telepathy::ChannelDetailsList>();
+    qDBusRegisterMetaType<org::freedesktop::Telepathy::ContactCapabilities>();
+    qDBusRegisterMetaType<org::freedesktop::Telepathy::ContactCapabilitiesList>();
+    qDBusRegisterMetaType<org::freedesktop::Telepathy::CapabilityPair>();
+    qDBusRegisterMetaType<org::freedesktop::Telepathy::CapabilityPairList>();
+    qDBusRegisterMetaType<org::freedesktop::Telepathy::CapabilityChange>();
+    qDBusRegisterMetaType<org::freedesktop::Telepathy::CapabilityChangeList>();    
+    qDBusRegisterMetaType<org::freedesktop::Telepathy::RequestableChannelClass>();
+    qDBusRegisterMetaType<org::freedesktop::Telepathy::RequestableChannelClassList>();
+
+    QDBusConnection connection = QDBusConnection::sessionBus();
+
+    if (!connection.interface()->isServiceRegistered(cm_service_name))
+    {
+
+        // register CM on D-BUS:
+        if (connection.registerService(cm_service_name)){
+            qDebug(qPrintable(QObject::tr("Service %1 registered with session bus.").
+                       arg(cm_service_name)));
+        }
+        else{
+            qDebug(qPrintable(QObject::tr("Unable to register service %1 with session bus.").
+                       arg(cm_service_name)));
+        }
+
+    }
+
+    ConnectionManager connection_mgr(&app);
+    if (!connection.registerObject(cm_object_path,&connection_mgr)){
+        qDebug(qPrintable(QObject::tr("Unable to register VICaR connection manager at path %1 with session bus.").
+                   arg(cm_object_path)));
+    }
+
+    qDebug(qPrintable(QObject::tr("Enternig main loop.")));    
+//    logfile.close();
+    return app.exec();
+}
diff --git a/src/vicar-telepathy/src/names.h b/src/vicar-telepathy/src/names.h
new file mode 100644 (file)
index 0000000..6a4f560
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+
+Based on Telepathy-SNOM with copyright notice below.
+*/
+
+
+/*
+ * Telepathy SNOM VoIP phone connection manager
+ * Copyright (C) 2006 by basyskom GmbH
+ *  @author Tobias Hunger <info@basyskom.de>
+ *
+ * This library is free software; you can redisQObject::tribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is disQObject::tributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin SQObject::treet, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef _VICAR_NAMES_H_
+#define _VICAR_NAMES_H_
+
+#define cm_service_name                 "org.freedesktop.Telepathy.ConnectionManager.vicar"
+#define cm_object_path                  "/org/freedesktop/Telepathy/ConnectionManager/vicar"
+#define cm_interface_name               "org.freedesktop.Telepathy.ConnectionManager"
+
+#define ACCOUNT_MGR_NAME                "org.freedesktop.Telepathy.AccountManager"
+#define ACCOUNT_MGR_PATH                "/org/freedesktop/Telepathy/AccountManager"
+#define ACCOUNT_MGR_IFACE_QUERY         "com.nokia.AccountManager.Interface.Query"
+#define ACCOUNT_IFACE_COMPAT            "com.nokia.Account.Interface.Compat"
+#define ACCOUNT_IFACE_COMPAT_PROFILE    "com.nokia.Account.Interface.Compat.Profile"
+#define DBUS_PROPERTIES                 "org.freedesktop.DBus.Properties"
+
+#define APPLICATION_DBUS_PATH           "/org/maemo/vicar"
+#define APPLICATION_DBUS_INTERFACE      "org.maemo.vicar"
+#define APPLICATION_DBUS_SERVICE        "org.maemo.vicar"
+
+#endif
diff --git a/src/vicar-telepathy/src/vicarcallrouterproxy.cpp b/src/vicar-telepathy/src/vicarcallrouterproxy.cpp
new file mode 100644 (file)
index 0000000..7bd1be3
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -c VicarCallRouterProxy -p vicarcallrouterproxy.h:vicarcallrouterproxy.cpp org.maemo.vicar.xml org.maemo.vicar
+ *
+ * qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#include "vicarcallrouterproxy.h"
+
+/*
+ * Implementation of interface class VicarCallRouterProxy
+ */
+
+VicarCallRouterProxy::VicarCallRouterProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
+    : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
+{
+}
+
+VicarCallRouterProxy::~VicarCallRouterProxy()
+{
+}
+
diff --git a/src/vicar-telepathy/src/vicarcallrouterproxy.h b/src/vicar-telepathy/src/vicarcallrouterproxy.h
new file mode 100644 (file)
index 0000000..d0fa3e3
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -c VicarCallRouterProxy -p vicarcallrouterproxy.h:vicarcallrouterproxy.cpp org.maemo.vicar.xml org.maemo.vicar
+ *
+ * qdbusxml2cpp is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#ifndef VICARCALLROUTERPROXY_H_1280455099
+#define VICARCALLROUTERPROXY_H_1280455099
+
+#include <QtCore/QObject>
+#include <QtCore/QByteArray>
+#include <QtCore/QList>
+#include <QtCore/QMap>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
+#include <QtCore/QVariant>
+#include <QtDBus/QtDBus>
+
+/*
+ * Proxy class for interface org.maemo.vicar
+ */
+class VicarCallRouterProxy: public QDBusAbstractInterface
+{
+    Q_OBJECT
+public:
+    static inline const char *staticInterfaceName()
+    { return "org.maemo.vicar"; }
+
+public:
+    VicarCallRouterProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
+
+    ~VicarCallRouterProxy();
+
+public Q_SLOTS: // METHODS
+    inline QDBusPendingReply<QString> callInternationalNumber(const QString &number)
+    {
+        QList<QVariant> argumentList;
+        argumentList << qVariantFromValue(number);
+        return asyncCallWithArgumentList(QLatin1String("callInternationalNumber"), argumentList);
+    }
+
+    inline QDBusPendingReply<bool> isRunning()
+    {
+        QList<QVariant> argumentList;
+        return asyncCallWithArgumentList(QLatin1String("isRunning"), argumentList);
+    }
+
+    inline QDBusPendingReply<bool> startOutgoingCallMonitor()
+    {
+        QList<QVariant> argumentList;
+        return asyncCallWithArgumentList(QLatin1String("startOutgoingCallMonitor"), argumentList);
+    }
+
+    inline QDBusPendingReply<bool> stopOutgoingCallMonitor()
+    {
+        QList<QVariant> argumentList;
+        return asyncCallWithArgumentList(QLatin1String("stopOutgoingCallMonitor"), argumentList);
+    }
+
+Q_SIGNALS: // SIGNALS
+};
+
+namespace org {
+  namespace maemo {
+    typedef ::VicarCallRouterProxy vicar;
+  }
+}
+#endif
diff --git a/src/vicar-telepathy/vicar-telepathy.pro b/src/vicar-telepathy/vicar-telepathy.pro
new file mode 100644 (file)
index 0000000..2522ef7
--- /dev/null
@@ -0,0 +1,56 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2010-06-22T19:17:05
+#
+#-------------------------------------------------
+
+#INCLUDEPATH += /usr/include/telepathy-1.0
+#LIBS += /usr/lib/libtelepathy-qt4.so
+
+QT       += dbus core
+QT       -= gui
+
+TARGET = vicar-telepathy
+CONFIG   += qt debug console
+CONFIG   -= app_bundle
+
+TEMPLATE = app
+VPATH += src
+MOC_DIR = mocs
+OBJECTS_DIR = objs
+SOURCES += src/main.cpp \
+    src/connectiontypes.cpp \
+    src/connectionmanagertypes.cpp \
+    src/connectionmanageradaptor.cpp \
+    src/connectionmanager.cpp \
+    src/connectionadaptor.cpp \
+    src/connection.cpp \
+    src/connectioninterfacerequeststypes.cpp \
+    src/connectioninterfacerequestsadaptor.cpp \
+    src/vicarcallrouterproxy.cpp \
+    src/connectioninterfacecapabilitiestypes.cpp \
+    src/connectioninterfacecapabilitiesadaptor.cpp
+
+# On device application depends on libtelepathy-qt4-0 (Not required now)
+
+HEADERS += \
+    src/names.h \
+    src/connectiontypes.h \
+    src/connectionmanagertypes.h \
+    src/connectionmanageradaptor.h \
+    src/connectionmanager.h \
+    src/connectionadaptor.h \
+    src/connection.h \
+    src/basetypes.h \
+    src/connectioninterfacerequeststypes.h \
+    src/connectioninterfacerequestsadaptor.h \
+    src/vicarcallrouterproxy.h \
+    src/connectioninterfacecapabilitiestypes.h \
+    src/connectioninterfacecapabilitiesadaptor.h
+
+#MAKE INSTALL
+INSTALLDIR = /../../debian/vicar
+
+INSTALLS += target
+
+target.path =$$INSTALLDIR/opt/vicar
diff --git a/src/vicar-utils/src/main.cpp b/src/vicar-utils/src/main.cpp
new file mode 100755 (executable)
index 0000000..a88b3fb
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+@version: 0.5
+@author: Sudheer K. <scifi1947 at gmail.com>
+@license: GNU General Public License
+*/
+
+#include "telepathyutility.h"
+#include "databaseutility.h"
+#include "vicarprofiletypes.h"
+#include <QDebug>
+#include <QDBusMetaType>
+
+int main(int argc, char *argv[])
+{
+    qDBusRegisterMetaType<org::freedesktop::Telepathy::SimplePresence>();
+    //qDBusRegisterMetaType<org::maemo::vicar::Profile>();
+    //qDBusRegisterMetaType<org::maemo::vicar::ProfileList>();
+
+    TelepathyUtility *tpUtility = new TelepathyUtility();
+    DatabaseUtility *databaseUtility = new DatabaseUtility();
+
+    if (argc > 1 && argv[1]){
+        QString instruction = QString(argv[1]);
+        if (instruction == "INSTALL"){
+            //Check if Account already exists
+            if (!tpUtility->accountExists()){
+                qDebug() << "VICaR account not found. Creating ..";
+                bool result = tpUtility->createAccount();
+                if (!result) exit(1);
+            }
+            else{
+                qDebug() << "VICaR account found.";
+            }
+        }
+        else if (instruction == "REMOVE"){
+            bool result = tpUtility->deleteAccount();
+            if (!result) exit(2);
+        }
+
+        else if (instruction == "CREATEDB"){
+            bool result = databaseUtility->openDatabase();
+            if (!result){
+                qDebug() <<"Error creating profiles database. "
+                        <<databaseUtility->lastError();
+                exit(3);
+            }
+            qDebug() << "VICaR profiles database opened.";
+
+            if (!databaseUtility->tableExists("profiles")){
+                qDebug() << "Creating VICaR profiles table..";
+                result = databaseUtility->createProfilesTable();
+                if (!result){
+                    qDebug() <<"Error creating profiles table. "
+                            <<databaseUtility->lastError();
+                    exit(4);
+                }
+            }
+            else{
+                qDebug()<<"Profiles table exists";
+            }
+            databaseUtility->closeDatabase();
+        }
+        else if (instruction == "DROPDB"){
+            bool result = databaseUtility->deleteDatabase();
+            if (!result){
+                qDebug() <<"Error deleting profiles database. "
+                        <<databaseUtility->lastError();
+                exit(5);
+            }
+            qDebug() << "VICaR profiles database deleted.";
+        }
+        else if (instruction == "ACCOUNTSTATUS"){
+            QString status = tpUtility->getAccountStatus();
+            qDebug() << "Account Status is "<< status;
+        }
+    }
+
+    delete (tpUtility);
+    delete (databaseUtility);
+    tpUtility = 0;
+    databaseUtility = 0;
+}
diff --git a/src/vicar-utils/vicar-utils.pro b/src/vicar-utils/vicar-utils.pro
new file mode 100755 (executable)
index 0000000..0764089
--- /dev/null
@@ -0,0 +1,24 @@
+CONFIG += qt debug
+QT += dbus sql
+QT -= gui
+TEMPLATE = app
+TARGET = vicar-utils
+CONFIG += console
+CONFIG -= app_bundle
+
+INCLUDEPATH += ../vicar-lib/src
+LIBS += ../lib/libvicar.a
+
+VPATH += src
+MOC_DIR = mocs
+OBJECTS_DIR = objs
+
+SOURCES += src/main.cpp
+
+#MAKE INSTALL
+INSTALLDIR = /../../debian/vicar
+
+INSTALLS += target
+
+target.path =$$INSTALLDIR/opt/vicar
+
old mode 100644 (file)
new mode 100755 (executable)
diff --git a/welcome b/welcome
old mode 100644 (file)
new mode 100755 (executable)