From: Sudheer K Date: Thu, 5 Jan 2012 07:58:03 +0000 (-0800) Subject: Version 0.7-0 X-Git-Url: http://vcs.maemo.org/git/?p=vicar;a=commitdiff_plain;h=74800375ecf7f41e290cf7cc7fa9ee8b230be68e Version 0.7-0 --- diff --git a/debian b/debian new file mode 120000 index 0000000..3fa3469 --- /dev/null +++ b/debian @@ -0,0 +1 @@ +qtc_packaging/debian_harmattan \ No newline at end of file diff --git a/debian/changelog b/debian/changelog deleted file mode 100755 index 309c24a..0000000 --- a/debian/changelog +++ /dev/null @@ -1,6 +0,0 @@ -vicar (0.6-2) unstable; urgency=low - - * Calling card number can now have a +. - - -- Sudheer K. Sun, 12 Dec 2011 16:10:00 -0800 - diff --git a/debian/compat b/debian/compat deleted file mode 100755 index 7ed6ff8..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/debian/control b/debian/control deleted file mode 100755 index 0200b85..0000000 --- a/debian/control +++ /dev/null @@ -1,80 +0,0 @@ -Source: vicar -Section: user/network -Priority: extra -Maintainer: Sudheer K. -Build-Depends: debhelper (>= 5), libqt4-dev, libgconf2-dev -Standards-Version: 3.7.2 -Homepage: vicar.garage.maemo.org -XSBC-Bugtracker: https://garage.maemo.org/tracker/?atid=5673&group_id=1586 -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 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= diff --git a/debian/copyright b/debian/copyright deleted file mode 100755 index 6327fef..0000000 --- a/debian/copyright +++ /dev/null @@ -1,34 +0,0 @@ -This package was debianized by Sudheer K. on -Sat, 8 May 2010 13:57:08 -0700. - -It was downloaded from https://garage.maemo.org/projects/vicar - -Upstream Author: Sudheer K. - -Copyright: 2010, Sudheer K. - -License: - - This package is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This package 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this package; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -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. and -is licensed under the GPL, see above. - - -# Please also look if there are files or directories which have a -# different copyright/license attached and list them here. diff --git a/debian/dirs b/debian/dirs deleted file mode 100755 index e69de29..0000000 diff --git a/debian/docs b/debian/docs deleted file mode 100755 index e69de29..0000000 diff --git a/debian/files b/debian/files deleted file mode 100644 index 61c829e..0000000 --- a/debian/files +++ /dev/null @@ -1 +0,0 @@ -vicar_0.6-2_armel.deb user/network extra diff --git a/debian/postinst b/debian/postinst deleted file mode 100755 index df0e349..0000000 --- a/debian/postinst +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/sh -# postinst script for vicar -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `configure' -# * `abort-upgrade' -# * `abort-remove' `in-favour' -# -# * `abort-remove' -# * `abort-deconfigure' `in-favour' -# `removing' -# -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - configure) - - eval $(dbus-launch --sh-syntax) - export DBUS_SESSION_BUS_ADDRESS - export DBUS_SESSION_BUS_PID - - # 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" - - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - ;; - - *) - echo "postinst 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 - - diff --git a/debian/postrm b/debian/postrm deleted file mode 100755 index f832c85..0000000 --- a/debian/postrm +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -# postrm script for vicar -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `remove' -# * `purge' -# * `upgrade' -# * `failed-upgrade' -# * `abort-install' -# * `abort-install' -# * `abort-upgrade' -# * `disappear' -# -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - purge) - echo "Deleting configuration from GConf ..." - gconftool-2 --recursive-unset /apps/Maemo/vicar - echo "Removing logs ..." - [[ -x /var/log/vicar.log ]] && rm -f /var/log/vicar.log - ;; - - remove|abort-install) - echo "Removing unused scripts ..." - ;; - - upgrade|failed-upgrade|abort-upgrade|disappear) - ;; - - *) - echo "postrm 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 - - diff --git a/debian/prerm b/debian/prerm deleted file mode 100755 index 24cf8b8..0000000 --- a/debian/prerm +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -# prerm script for vicar -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `remove' -# * `upgrade' -# * `failed-upgrade' -# * `remove' `in-favour' -# * `deconfigure' `in-favour' -# `removing' -# -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - remove|deconfigure) - - eval $(dbus-launch --sh-syntax) - export DBUS_SESSION_BUS_ADDRESS - export DBUS_SESSION_BUS_PID - - 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 diff --git a/debian/rules b/debian/rules deleted file mode 100755 index fd099c3..0000000 --- a/debian/rules +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- -# Sample debian/rules that uses debhelper. -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 - -APPNAME := vicar -builddir: - mkdir -p builddir - -builddir/Makefile: builddir - cd builddir && qmake ../$(APPNAME).pro - -build: build-stamp - -build-stamp: builddir/Makefile - dh_testdir - - # Add here commands to compile the package. - cd builddir && $(MAKE) - #docbook-to-man debian/$(APPNAME).sgml > $(APPNAME).1 - - touch $@ - -clean: - dh_testdir - dh_testroot - rm -f build-stamp - - # Add here commands to clean up after the build process. - rm -rf builddir - - dh_clean - -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - - # Add here commands to install the package into debian/arora. - cd builddir && $(MAKE) INSTALL_ROOT=$(CURDIR)/debian/$(APPNAME) install - - -# Build architecture-independent files here. -binary-indep: build install -# We have nothing to do by default. - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir - dh_testroot - dh_installdocs - dh_installexamples - dh_installman - dh_link - dh_strip - dh_compress - dh_fixperms - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/debian/vicar.substvars b/debian/vicar.substvars deleted file mode 100644 index f550295..0000000 --- a/debian/vicar.substvars +++ /dev/null @@ -1,2 +0,0 @@ -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.7.0~git20100909), libqt4-dbus (>= 4.7.0~git20100909), libqt4-gui (>= 4.7.0~git20100909), libqt4-sql (>= 4.7.0~git20100909), libqt4-xml (>= 4.7.0~git20100909), libstdc++6 (>= 4.2.1) -misc:Depends= diff --git a/qtc_packaging/debian_fremantle/changelog b/qtc_packaging/debian_fremantle/changelog new file mode 100755 index 0000000..4719d11 --- /dev/null +++ b/qtc_packaging/debian_fremantle/changelog @@ -0,0 +1,5 @@ +vicar (0.7-0maemo5) unstable; urgency=low + + * Added Harmattan support + -- Sudheer K. Mon, 22 Aug 2011 16:10:00 -0800 + diff --git a/qtc_packaging/debian_fremantle/compat b/qtc_packaging/debian_fremantle/compat new file mode 100755 index 0000000..7ed6ff8 --- /dev/null +++ b/qtc_packaging/debian_fremantle/compat @@ -0,0 +1 @@ +5 diff --git a/qtc_packaging/debian_fremantle/control b/qtc_packaging/debian_fremantle/control new file mode 100755 index 0000000..8ca9ecd --- /dev/null +++ b/qtc_packaging/debian_fremantle/control @@ -0,0 +1,80 @@ +Source: vicar +Section: user/network +Priority: extra +Maintainer: Sudheer K. +Build-Depends: debhelper (>= 5), libqt4-dev, libgconf2-dev +Standards-Version: 3.7.2 +Homepage: https://garage.maemo.org/projects/vicar +XSBC-Bugtracker: https://garage.maemo.org/tracker/?atid=5673&group_id=1586 +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 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= diff --git a/qtc_packaging/debian_fremantle/copyright b/qtc_packaging/debian_fremantle/copyright new file mode 100755 index 0000000..6327fef --- /dev/null +++ b/qtc_packaging/debian_fremantle/copyright @@ -0,0 +1,34 @@ +This package was debianized by Sudheer K. on +Sat, 8 May 2010 13:57:08 -0700. + +It was downloaded from https://garage.maemo.org/projects/vicar + +Upstream Author: Sudheer K. + +Copyright: 2010, Sudheer K. + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +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. and +is licensed under the GPL, see above. + + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/qtc_packaging/debian_fremantle/dirs b/qtc_packaging/debian_fremantle/dirs new file mode 100755 index 0000000..e69de29 diff --git a/qtc_packaging/debian_fremantle/docs b/qtc_packaging/debian_fremantle/docs new file mode 100755 index 0000000..e69de29 diff --git a/qtc_packaging/debian_fremantle/files b/qtc_packaging/debian_fremantle/files new file mode 100644 index 0000000..a284820 --- /dev/null +++ b/qtc_packaging/debian_fremantle/files @@ -0,0 +1 @@ +vicar_0.7-0maemo5_armel.deb user/network extra diff --git a/qtc_packaging/debian_fremantle/postinst b/qtc_packaging/debian_fremantle/postinst new file mode 100755 index 0000000..2b8a36d --- /dev/null +++ b/qtc_packaging/debian_fremantle/postinst @@ -0,0 +1,71 @@ +#!/bin/sh +# postinst script for vicar +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure) + + eval $(dbus-launch --sh-syntax) + export DBUS_SESSION_BUS_ADDRESS + export DBUS_SESSION_BUS_PID + + # Kill any running instances of the daemon (only used on Linux based systems) + killall -q vicar-daemon || true + killall -q vicar-telepathy || true + + echo "Checking for log folder ..." + [[ ! -d /var/log/vicar ]] && mkdir /var/log/vicar + + echo "Checking for log file ..." + [[ ! -e /var/log/vicar/vicar.log ]] && touch /var/log/vicar/vicar.log && chown -R user:users /var/log/vicar + + echo "Starting Vicar daemon ..." + [[ -x /opt/vicar/bin/vicar-daemon ]] && su - user -c "exec /opt/vicar/bin/vicar-daemon& >/dev/null" + + echo "Starting Vicar-Telepathy ..." + [[ -x /opt/vicar/bin/vicar-telepathy ]] && su - user -c "exec /opt/vicar/bin/vicar-telepathy& >/dev/null" + + echo "Creating Vicar Telepathy account ..." + [[ -x /opt/vicar/bin/vicar-utils ]] && su - user -c "exec /opt/vicar/bin/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/bin/vicar-utils ]] && su - user -c "exec /opt/vicar/bin/vicar-utils CREATEDB" + + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst 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 + + diff --git a/qtc_packaging/debian_fremantle/postrm b/qtc_packaging/debian_fremantle/postrm new file mode 100755 index 0000000..5e17b2b --- /dev/null +++ b/qtc_packaging/debian_fremantle/postrm @@ -0,0 +1,47 @@ +#!/bin/sh +# postrm script for vicar +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge) + echo "Removing logs ..." + [[ -d /var/log/vicar ]] && rm -rf /var/log/vicar + ;; + + remove|abort-install) + ;; + + upgrade|failed-upgrade|abort-upgrade|disappear) + ;; + + *) + echo "postrm 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 + + diff --git a/qtc_packaging/debian_fremantle/prerm b/qtc_packaging/debian_fremantle/prerm new file mode 100644 index 0000000..6211b18 --- /dev/null +++ b/qtc_packaging/debian_fremantle/prerm @@ -0,0 +1,58 @@ +#!/bin/sh +# prerm script for vicar +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove|deconfigure) + + eval $(dbus-launch --sh-syntax) + export DBUS_SESSION_BUS_ADDRESS + export DBUS_SESSION_BUS_PID + + echo "Deleting Vicar Telepathy account ..." + [[ -x /opt/vicar/bin/vicar-utils ]] && su - user -c "exec /opt/vicar/bin/vicar-utils REMOVE" + + echo "Deleting Vicar Profiles database ..." + [[ -x /opt/vicar/bin/vicar-utils ]] && su - user -c "exec /opt/vicar/bin/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 diff --git a/qtc_packaging/debian_fremantle/rules b/qtc_packaging/debian_fremantle/rules new file mode 100755 index 0000000..46da245 --- /dev/null +++ b/qtc_packaging/debian_fremantle/rules @@ -0,0 +1,91 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + + + + +configure: configure-stamp +configure-stamp: + dh_testdir + # qmake PREFIX=/usr# Uncomment this line for use without Qt Creator + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + # $(MAKE) # Uncomment this line for use without Qt Creator + #docbook-to-man debian/vicar.sgml > vicar.1 + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + $(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/vicar. + $(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/vicar install + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples +# dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + dh_installdeb + # dh_shlibdeps # Uncomment this line for use without Qt Creator + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/qtc_packaging/debian_fremantle/vicar.substvars b/qtc_packaging/debian_fremantle/vicar.substvars new file mode 100644 index 0000000..2d4bfa9 --- /dev/null +++ b/qtc_packaging/debian_fremantle/vicar.substvars @@ -0,0 +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.7.0~git20100909), libqt4-dbus (>= 4.7.0~git20100909), libqt4-gui (>= 4.7.0~git20100909), libqt4-sql (>= 4.7.0~git20100909), libqt4-xml (>= 4.7.0~git20100909), libstdc++6 (>= 4.2.1) diff --git a/qtc_packaging/debian_harmattan/changelog b/qtc_packaging/debian_harmattan/changelog new file mode 100755 index 0000000..79cdd4a --- /dev/null +++ b/qtc_packaging/debian_harmattan/changelog @@ -0,0 +1,5 @@ +vicar (0.7-0maemo6) unstable; urgency=low + + * Added Harmattan support + -- Sudheer K. Mon, 22 Aug 2011 16:10:00 -0800 + diff --git a/qtc_packaging/debian_harmattan/compat b/qtc_packaging/debian_harmattan/compat new file mode 100755 index 0000000..7f8f011 --- /dev/null +++ b/qtc_packaging/debian_harmattan/compat @@ -0,0 +1 @@ +7 diff --git a/qtc_packaging/debian_harmattan/control b/qtc_packaging/debian_harmattan/control new file mode 100755 index 0000000..b0626a1 --- /dev/null +++ b/qtc_packaging/debian_harmattan/control @@ -0,0 +1,80 @@ +Source: vicar +Section: user/network +Priority: extra +Maintainer: Sudheer K. +Build-Depends: debhelper (>= 5), libqt4-dev, libgconf2-dev, applauncherd-dev, libaccounts-qt-dev +Standards-Version: 3.7.3 +Homepage: https://garage.maemo.org/projects/vicar +XSBC-Bugtracker: https://garage.maemo.org/tracker/?atid=5673&group_id=1586 +XB-Maemo-Display-Name: VICaR - Value International Call Router + +Package: vicar +Architecture: any +Depends: ${shlibs:Depends}, applauncherd, libaccounts-qt1 +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= diff --git a/qtc_packaging/debian_harmattan/control_debug b/qtc_packaging/debian_harmattan/control_debug new file mode 100755 index 0000000..5fe1a14 --- /dev/null +++ b/qtc_packaging/debian_harmattan/control_debug @@ -0,0 +1,88 @@ +Source: vicar +Section: user/network +Priority: extra +Maintainer: Sudheer K. +Build-Depends: debhelper (>= 5), libqt4-dev, libgconf2-dev +Standards-Version: 3.7.3 +Homepage: https://garage.maemo.org/projects/vicar +XSBC-Bugtracker: https://garage.maemo.org/tracker/?atid=5673&group_id=1586 +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 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= + + +Package: vicar-dbg +Architecture: any +Section: devel +Depends: vicar (= ${binary:Version}) +Description: Automatically routes international GSM calls through a calling card or skype-out number. + This packages contains the debugging symbols for VICaR. diff --git a/qtc_packaging/debian_harmattan/copyright b/qtc_packaging/debian_harmattan/copyright new file mode 100755 index 0000000..6327fef --- /dev/null +++ b/qtc_packaging/debian_harmattan/copyright @@ -0,0 +1,34 @@ +This package was debianized by Sudheer K. on +Sat, 8 May 2010 13:57:08 -0700. + +It was downloaded from https://garage.maemo.org/projects/vicar + +Upstream Author: Sudheer K. + +Copyright: 2010, Sudheer K. + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +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. and +is licensed under the GPL, see above. + + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/qtc_packaging/debian_harmattan/dirs b/qtc_packaging/debian_harmattan/dirs new file mode 100755 index 0000000..e69de29 diff --git a/qtc_packaging/debian_harmattan/docs b/qtc_packaging/debian_harmattan/docs new file mode 100755 index 0000000..e69de29 diff --git a/qtc_packaging/debian_harmattan/files b/qtc_packaging/debian_harmattan/files new file mode 100644 index 0000000..e25cf5d --- /dev/null +++ b/qtc_packaging/debian_harmattan/files @@ -0,0 +1 @@ +vicar_0.7-0maemo6_armel.deb user/network extra diff --git a/qtc_packaging/debian_harmattan/manifest.aegis b/qtc_packaging/debian_harmattan/manifest.aegis new file mode 100644 index 0000000..e69de29 diff --git a/qtc_packaging/debian_harmattan/manifest.aegis_old b/qtc_packaging/debian_harmattan/manifest.aegis_old new file mode 100644 index 0000000..e69de29 diff --git a/qtc_packaging/debian_harmattan/postinst_DONTUSE b/qtc_packaging/debian_harmattan/postinst_DONTUSE new file mode 100644 index 0000000..e608d4c --- /dev/null +++ b/qtc_packaging/debian_harmattan/postinst_DONTUSE @@ -0,0 +1,71 @@ +#!/bin/sh +# postinst script for vicar +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure) + + eval $(dbus-launch --sh-syntax) + export DBUS_SESSION_BUS_ADDRESS + export DBUS_SESSION_BUS_PID + + # Kill any running instances of the daemon (only used on Linux based systems) + #killall -q vicar-daemon || true + #killall -q vicar-telepathy || true + + echo "Checking for log folder ..." + [[ ! -d /var/log/vicar ]] && mkdir /var/log/vicar + + echo "Checking for log file ..." + [[ ! -e /var/log/vicar/vicar.log ]] && touch /var/log/vicar/vicar.log && chown -R user:users /var/log/vicar + + echo "Starting Vicar daemon ..." + #[[ -x /opt/vicar/bin/vicar-daemon ]] && su - user -c "exec /opt/vicar/bin/vicar-daemon& >/dev/null" + + echo "Starting Vicar-Telepathy ..." + #[[ -x /opt/vicar/bin/vicar-telepathy ]] && su - user -c "exec /opt/vicar/bin/vicar-telepathy& >/dev/null" + + echo "Creating Vicar Telepathy account ..." + #[[ -x /opt/vicar/bin/vicar-utils ]] && su - user -c "exec /opt/vicar/bin/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/bin/vicar-utils ]] && su - user -c "exec /opt/vicar/bin/vicar-utils CREATEDB" + + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst 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 + + diff --git a/qtc_packaging/debian_harmattan/postrm b/qtc_packaging/debian_harmattan/postrm new file mode 100755 index 0000000..715c06a --- /dev/null +++ b/qtc_packaging/debian_harmattan/postrm @@ -0,0 +1,47 @@ +#!/bin/sh +# postrm script for vicar +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge) + echo "Removing logs ..." + #[[ -d /var/log/vicar ]] && rm -rf /var/log/vicar + ;; + + remove|abort-install) + ;; + + upgrade|failed-upgrade|abort-upgrade|disappear) + ;; + + *) + echo "postrm 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 + + diff --git a/qtc_packaging/debian_harmattan/prerm b/qtc_packaging/debian_harmattan/prerm new file mode 100755 index 0000000..0d0de12 --- /dev/null +++ b/qtc_packaging/debian_harmattan/prerm @@ -0,0 +1,58 @@ +#!/bin/sh +# prerm script for vicar +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove|deconfigure) + + eval $(dbus-launch --sh-syntax) + export DBUS_SESSION_BUS_ADDRESS + export DBUS_SESSION_BUS_PID + + echo "Deleting Vicar Telepathy account ..." + #[[ -x /opt/vicar/bin/vicar-utils ]] && su - user -c "exec /opt/vicar/bin/vicar-utils REMOVE" + + echo "Deleting Vicar Profiles database ..." + #[[ -x /opt/vicar/bin/vicar-utils ]] && su - user -c "exec /opt/vicar/bin/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 diff --git a/qtc_packaging/debian_harmattan/rules b/qtc_packaging/debian_harmattan/rules new file mode 100755 index 0000000..46da245 --- /dev/null +++ b/qtc_packaging/debian_harmattan/rules @@ -0,0 +1,91 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + + + + +configure: configure-stamp +configure-stamp: + dh_testdir + # qmake PREFIX=/usr# Uncomment this line for use without Qt Creator + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + # Add here commands to compile the package. + # $(MAKE) # Uncomment this line for use without Qt Creator + #docbook-to-man debian/vicar.sgml > vicar.1 + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + $(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/vicar. + $(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/vicar install + + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples +# dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_python +# dh_installinit +# dh_installcron +# dh_installinfo + dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + dh_installdeb + # dh_shlibdeps # Uncomment this line for use without Qt Creator + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/qtc_packaging/debian_harmattan/vicar-dbg.substvars b/qtc_packaging/debian_harmattan/vicar-dbg.substvars new file mode 100644 index 0000000..abd3ebe --- /dev/null +++ b/qtc_packaging/debian_harmattan/vicar-dbg.substvars @@ -0,0 +1 @@ +misc:Depends= diff --git a/qtc_packaging/debian_harmattan/vicar-dbg/DEBIAN/control b/qtc_packaging/debian_harmattan/vicar-dbg/DEBIAN/control new file mode 100644 index 0000000..987bd72 --- /dev/null +++ b/qtc_packaging/debian_harmattan/vicar-dbg/DEBIAN/control @@ -0,0 +1,15 @@ +Package: vicar-dbg +Source: vicar +Version: 0.7-0maemo6 +Architecture: armel +Maintainer: Sudheer K. +Installed-Size: 7084 +Depends: vicar (= 0.7-0maemo6) +Section: devel +Priority: extra +Homepage: https://garage.maemo.org/projects/vicar +Description: Automatically routes international GSM calls through a calling card or skype-out number. + This packages contains the debugging symbols for VICaR. +Aegis-Manifest: empty +Bugtracker: https://garage.maemo.org/tracker/?atid=5673&group_id=1586 +Maemo-Display-Name: VICaR - Value International Call Router diff --git a/qtc_packaging/debian_harmattan/vicar-dbg/DEBIAN/digsigsums b/qtc_packaging/debian_harmattan/vicar-dbg/DEBIAN/digsigsums new file mode 100644 index 0000000..da5f67f --- /dev/null +++ b/qtc_packaging/debian_harmattan/vicar-dbg/DEBIAN/digsigsums @@ -0,0 +1,3 @@ +S 15 com.nokia.maemo H 40 168db240cfaa1d7354fc9cd7349ebad45837d6e0 R 36 usr/lib/debug/opt/vicar/vicar-daemon +S 15 com.nokia.maemo H 40 0c59af9c01dc22013a5d547223968e2048ebf1d6 R 39 usr/lib/debug/opt/vicar/vicar-telepathy +S 15 com.nokia.maemo H 40 fbd25d17608299a04787929b7943ac02e70e7403 R 35 usr/lib/debug/opt/vicar/vicar-utils diff --git a/qtc_packaging/debian_harmattan/vicar-dbg/DEBIAN/md5sums b/qtc_packaging/debian_harmattan/vicar-dbg/DEBIAN/md5sums new file mode 100644 index 0000000..1cccb56 --- /dev/null +++ b/qtc_packaging/debian_harmattan/vicar-dbg/DEBIAN/md5sums @@ -0,0 +1,4 @@ +94c5118afac985166dad92d570b92bde usr/lib/debug/opt/vicar/vicar-daemon +a6b5e63b8efc6694831c0149a2b2190a usr/lib/debug/opt/vicar/vicar-telepathy +8cf9c300f128a5aed4d1e8aea2240ca3 usr/lib/debug/opt/vicar/vicar-utils +2fa624231f0d198505e7ca08d461b494 usr/share/doc/vicar-dbg/copyright diff --git a/qtc_packaging/debian_harmattan/vicar-dbg/usr/lib/debug/opt/vicar/vicar-daemon b/qtc_packaging/debian_harmattan/vicar-dbg/usr/lib/debug/opt/vicar/vicar-daemon new file mode 100644 index 0000000..fa6a4f0 Binary files /dev/null and b/qtc_packaging/debian_harmattan/vicar-dbg/usr/lib/debug/opt/vicar/vicar-daemon differ diff --git a/qtc_packaging/debian_harmattan/vicar-dbg/usr/lib/debug/opt/vicar/vicar-telepathy b/qtc_packaging/debian_harmattan/vicar-dbg/usr/lib/debug/opt/vicar/vicar-telepathy new file mode 100644 index 0000000..40ed7ba Binary files /dev/null and b/qtc_packaging/debian_harmattan/vicar-dbg/usr/lib/debug/opt/vicar/vicar-telepathy differ diff --git a/qtc_packaging/debian_harmattan/vicar-dbg/usr/lib/debug/opt/vicar/vicar-utils b/qtc_packaging/debian_harmattan/vicar-dbg/usr/lib/debug/opt/vicar/vicar-utils new file mode 100644 index 0000000..9fac725 Binary files /dev/null and b/qtc_packaging/debian_harmattan/vicar-dbg/usr/lib/debug/opt/vicar/vicar-utils differ diff --git a/qtc_packaging/debian_harmattan/vicar-dbg/usr/share/doc/vicar-dbg/copyright b/qtc_packaging/debian_harmattan/vicar-dbg/usr/share/doc/vicar-dbg/copyright new file mode 100644 index 0000000..6327fef --- /dev/null +++ b/qtc_packaging/debian_harmattan/vicar-dbg/usr/share/doc/vicar-dbg/copyright @@ -0,0 +1,34 @@ +This package was debianized by Sudheer K. on +Sat, 8 May 2010 13:57:08 -0700. + +It was downloaded from https://garage.maemo.org/projects/vicar + +Upstream Author: Sudheer K. + +Copyright: 2010, Sudheer K. + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +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. and +is licensed under the GPL, see above. + + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. diff --git a/qtc_packaging/debian_harmattan/vicar.aegis b/qtc_packaging/debian_harmattan/vicar.aegis new file mode 100644 index 0000000..319b253 --- /dev/null +++ b/qtc_packaging/debian_harmattan/vicar.aegis @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qtc_packaging/debian_harmattan/vicar.substvars b/qtc_packaging/debian_harmattan/vicar.substvars new file mode 100644 index 0000000..abd3ebe --- /dev/null +++ b/qtc_packaging/debian_harmattan/vicar.substvars @@ -0,0 +1 @@ +misc:Depends= diff --git a/src/data/accounts/vicar.provider b/src/data/accounts/vicar.provider new file mode 100644 index 0000000..cbc6dd7 --- /dev/null +++ b/src/data/accounts/vicar.provider @@ -0,0 +1,8 @@ + + + + Vicar + icon-m-service-vicar + Route calls via VICaR + Use Vicar to route calls via your calling card. Please use Vicar application to update routing preferences. + diff --git a/src/data/accounts/vicar.service b/src/data/accounts/vicar.service new file mode 100644 index 0000000..47db52c --- /dev/null +++ b/src/data/accounts/vicar.service @@ -0,0 +1,51 @@ + + + IM + VICaR Service Name + vicar + icon-m-service-vicar + + + + + + + diff --git a/src/data/dbus/org.freedesktop.Telepathy.ConnectionManager.vicar.service b/src/data/dbus/org.freedesktop.Telepathy.ConnectionManager.vicar.service new file mode 100644 index 0000000..7e6b898 --- /dev/null +++ b/src/data/dbus/org.freedesktop.Telepathy.ConnectionManager.vicar.service @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=org.freedesktop.Telepathy.ConnectionManager.vicar +Exec=/opt/vicar/bin/vicar-telepathy diff --git a/src/data/dbus/org.maemo.vicar.service b/src/data/dbus/org.maemo.vicar.service new file mode 100755 index 0000000..b608775 --- /dev/null +++ b/src/data/dbus/org.maemo.vicar.service @@ -0,0 +1,4 @@ +[D-BUS Service] +Name=org.maemo.vicar +Exec=/opt/vicar/bin/vicar-daemon +User=user diff --git a/src/data/desktop/vicar-config-qml.desktop b/src/data/desktop/vicar-config-qml.desktop new file mode 100644 index 0000000..b5fbe18 --- /dev/null +++ b/src/data/desktop/vicar-config-qml.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Vicar +Exec=/usr/bin/invoker --type=d -s /opt/vicar-config-qml/bin/vicar-config-qml +Icon=/usr/share/icons/hicolor/80x80/apps/vicar_harmattan.png +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/src/data/desktop/vicar-config.desktop b/src/data/desktop/vicar-config.desktop new file mode 100755 index 0000000..c66192e --- /dev/null +++ b/src/data/desktop/vicar-config.desktop @@ -0,0 +1,8 @@ +# Author: Sudheer K. +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Name=Vicar +Exec=/opt/vicar/bin/vicar-config +Icon=vicar_harmattan diff --git a/src/data/icons/26x26/vicar_harmattan.png b/src/data/icons/26x26/vicar_harmattan.png new file mode 100644 index 0000000..30589f0 Binary files /dev/null and b/src/data/icons/26x26/vicar_harmattan.png differ diff --git a/src/data/icons/26x26/vicar_phone.png b/src/data/icons/26x26/vicar_phone.png deleted file mode 100755 index c28ff95..0000000 Binary files a/src/data/icons/26x26/vicar_phone.png and /dev/null differ diff --git a/src/data/icons/32x32/vicar_harmattan.png b/src/data/icons/32x32/vicar_harmattan.png new file mode 100644 index 0000000..32b010c Binary files /dev/null and b/src/data/icons/32x32/vicar_harmattan.png differ diff --git a/src/data/icons/32x32/vicar_phone.png b/src/data/icons/32x32/vicar_phone.png deleted file mode 100755 index 5c717bd..0000000 Binary files a/src/data/icons/32x32/vicar_phone.png and /dev/null differ diff --git a/src/data/icons/48x48/vicar_harmattan.png b/src/data/icons/48x48/vicar_harmattan.png new file mode 100644 index 0000000..8c1f0d3 Binary files /dev/null and b/src/data/icons/48x48/vicar_harmattan.png differ diff --git a/src/data/icons/48x48/vicar_phone.png b/src/data/icons/48x48/vicar_phone.png deleted file mode 100755 index 9379353..0000000 Binary files a/src/data/icons/48x48/vicar_phone.png and /dev/null differ diff --git a/src/data/icons/64x64/vicar_harmattan.png b/src/data/icons/64x64/vicar_harmattan.png new file mode 100644 index 0000000..573f2dc Binary files /dev/null and b/src/data/icons/64x64/vicar_harmattan.png differ diff --git a/src/data/icons/64x64/vicar_phone.png b/src/data/icons/64x64/vicar_phone.png deleted file mode 100755 index 1c578a9..0000000 Binary files a/src/data/icons/64x64/vicar_phone.png and /dev/null differ diff --git a/src/data/icons/icon-m-service-vicar.png b/src/data/icons/icon-m-service-vicar.png new file mode 100644 index 0000000..573f2dc Binary files /dev/null and b/src/data/icons/icon-m-service-vicar.png differ diff --git a/src/data/icons/vicar_fremantle_icon.png b/src/data/icons/vicar_fremantle_icon.png new file mode 100755 index 0000000..8ad8f4a Binary files /dev/null and b/src/data/icons/vicar_fremantle_icon.png differ diff --git a/src/data/icons/vicar_harmattan.png b/src/data/icons/vicar_harmattan.png new file mode 100755 index 0000000..744352e Binary files /dev/null and b/src/data/icons/vicar_harmattan.png differ diff --git a/src/data/icons/vicar_scalable_icon.png b/src/data/icons/vicar_scalable_icon.png deleted file mode 100755 index 8ad8f4a..0000000 Binary files a/src/data/icons/vicar_scalable_icon.png and /dev/null differ diff --git a/src/data/org.freedesktop.Telepathy.ConnectionManager.vicar.service b/src/data/org.freedesktop.Telepathy.ConnectionManager.vicar.service deleted file mode 100644 index 8702fca..0000000 --- a/src/data/org.freedesktop.Telepathy.ConnectionManager.vicar.service +++ /dev/null @@ -1,3 +0,0 @@ -[D-BUS Service] -Name=org.freedesktop.Telepathy.ConnectionManager.vicar -Exec=/opt/vicar/vicar-telepathy diff --git a/src/data/org.maemo.vicar.service b/src/data/org.maemo.vicar.service deleted file mode 100755 index b39eaaf..0000000 --- a/src/data/org.maemo.vicar.service +++ /dev/null @@ -1,4 +0,0 @@ -[D-BUS Service] -Name=org.maemo.vicar -Exec=/opt/vicar/vicar-daemon -User=user diff --git a/src/data/telepathy/vicar-meego.manager b/src/data/telepathy/vicar-meego.manager new file mode 100644 index 0000000..c988e02 --- /dev/null +++ b/src/data/telepathy/vicar-meego.manager @@ -0,0 +1,24 @@ +[ConnectionManager] +BusName=org.freedesktop.Telepathy.ConnectionManager.vicar +ObjectPath=/org/freedesktop/Telepathy/ConnectionManager/vicar + +[Protocol tel] +param-org.freedesktop.Telepathy.Connection.Interface.Cellular.IMSI=s dbus-property +param-org.freedesktop.Telepathy.Connection.Interface.Cellular.MessageServiceCentre=s dbus-property + +# SMS validity period in seconds +# Range from 300 ... 38102400 (5 minutes to 63 weeks) +param-org.freedesktop.Telepathy.Connection.Interface.Cellular.MessageValidityPeriod=u dbus-property +default-org.freedesktop.Telepathy.Connection.Interface.Cellular.MessageValidityPeriod=0 + +param-org.freedesktop.Telepathy.Connection.Interface.Cellular.MessageReducedCharacterSet=b dbus-property +default-org.freedesktop.Telepathy.Connection.Interface.Cellular.MessageReducedCharacterSet=false + +param-org.freedesktop.Telepathy.Connection.Interface.Cellular.MessageNationalCharacterSet=s dbus-property + +param-org.freedesktop.Telepathy.Connection.Interface.Anonymity.AnonymityModes=u dbus-property +default-org.freedesktop.Telepathy.Connection.Interface.Anonymity.AnonymityModes=0 + +# Deprecated +param-account=s +param-password=s diff --git a/src/data/telepathy/vicar.manager b/src/data/telepathy/vicar.manager new file mode 100644 index 0000000..20f0be2 --- /dev/null +++ b/src/data/telepathy/vicar.manager @@ -0,0 +1,27 @@ +[ConnectionManager] +BusName=org.freedesktop.Telepathy.ConnectionManager.vicar +ObjectPath=/org/freedesktop/Telepathy/ConnectionManager/vicar + +[Protocol tel] +AddressableVCardFields=tel; +AddressableURISchemes=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/telepathy/vicar.profile b/src/data/telepathy/vicar.profile new file mode 100644 index 0000000..838b9e2 --- /dev/null +++ b/src/data/telepathy/vicar.profile @@ -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/vicar-config.desktop b/src/data/vicar-config.desktop deleted file mode 100755 index be24c3c..0000000 --- a/src/data/vicar-config.desktop +++ /dev/null @@ -1,8 +0,0 @@ -# Author: Sudheer K. -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Name=Vicar -Exec=/opt/vicar/vicar-config -Icon=vicar_scalable_icon diff --git a/src/data/vicar.manager b/src/data/vicar.manager deleted file mode 100644 index bdd8fc0..0000000 --- a/src/data/vicar.manager +++ /dev/null @@ -1,24 +0,0 @@ -[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 deleted file mode 100644 index 838b9e2..0000000 --- a/src/data/vicar.profile +++ /dev/null @@ -1,19 +0,0 @@ -[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/org.freedesktop.Telepathy.Connection.I.Capabilities.xml b/src/data/xml/org.freedesktop.Telepathy.Connection.I.Capabilities.xml new file mode 100644 index 0000000..9ac7ff4 --- /dev/null +++ b/src/data/xml/org.freedesktop.Telepathy.Connection.I.Capabilities.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/data/xml/org.freedesktop.Telepathy.Connection.I.Requests.xml b/src/data/xml/org.freedesktop.Telepathy.Connection.I.Requests.xml index 75d026c..a6d65ae 100644 --- a/src/data/xml/org.freedesktop.Telepathy.Connection.I.Requests.xml +++ b/src/data/xml/org.freedesktop.Telepathy.Connection.I.Requests.xml @@ -4,6 +4,10 @@ + + + + diff --git a/src/data/xml/org.freedesktop.Telepathy.Connection.ring.tel.ring.xml b/src/data/xml/org.freedesktop.Telepathy.Connection.ring.tel.ring.xml new file mode 100644 index 0000000..a4c49e4 --- /dev/null +++ b/src/data/xml/org.freedesktop.Telepathy.Connection.ring.tel.ring.xml @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/data/xml/org.freedesktop.Telepathy.Connection.vicar.tel.vicar.xml b/src/data/xml/org.freedesktop.Telepathy.Connection.vicar.tel.vicar.xml new file mode 100644 index 0000000..4c7cdba --- /dev/null +++ b/src/data/xml/org.freedesktop.Telepathy.Connection.vicar.tel.vicar.xml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/data/xml/org.freedesktop.Telepathy.Connection.xml b/src/data/xml/org.freedesktop.Telepathy.Connection.xml index 1cd18fc..2ecf8e4 100644 --- a/src/data/xml/org.freedesktop.Telepathy.Connection.xml +++ b/src/data/xml/org.freedesktop.Telepathy.Connection.xml @@ -2,6 +2,10 @@ + + + + @@ -17,12 +21,12 @@ - + - + @@ -32,7 +36,7 @@ - + @@ -44,11 +48,18 @@ - + + + + + + + + @@ -60,53 +71,13 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/src/data/xml/org.freedesktop.Telepathy.ConnectionManager.ring.xml b/src/data/xml/org.freedesktop.Telepathy.ConnectionManager.ring.xml new file mode 100644 index 0000000..d7fa3a2 --- /dev/null +++ b/src/data/xml/org.freedesktop.Telepathy.ConnectionManager.ring.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/data/xml/org.freedesktop.Telepathy.ConnectionManager.vicar.xml b/src/data/xml/org.freedesktop.Telepathy.ConnectionManager.vicar.xml new file mode 100644 index 0000000..e4877f6 --- /dev/null +++ b/src/data/xml/org.freedesktop.Telepathy.ConnectionManager.vicar.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/data/xml/org.sip.connection.properties b/src/data/xml/org.sip.connection.properties new file mode 100644 index 0000000..b628aae --- /dev/null +++ b/src/data/xml/org.sip.connection.properties @@ -0,0 +1,24 @@ + array [ + dict entry( + string "HasImmortalHandles" + variant boolean true + ) + dict entry( + string "Status" + variant uint32 0 + ) + dict entry( + string "SelfHandle" + variant uint32 1 + ) + dict entry( + string "Interfaces" + variant array [ + string "org.freedesktop.Telepathy.Connection.Interface.Requests" + string "org.freedesktop.Telepathy.Connection.Interface.Contacts" + string "org.freedesktop.Telepathy.Connection.Interface.Aliasing" + ] + ) + ] + +type=MethodReturn, service=":1.16", signature="a{sv}", contents=([Argument: a{sv} {"HasImmortalHandles" = [Variant(bool): true], "Status" = [Variant(uint): 0], "SelfHandle" = [Variant(uint): 1], "Interfaces" = [Variant(QStringList): {"org.freedesktop.Telepathy.Connection.Interface.Requests", "org.freedesktop.Telepathy.Connection.Interface.Contacts", "org.freedesktop.Telepathy.Connection.Interface.Capabilities", "org.freedesktop.Telepathy.Connection.Interface.ServicePoint", "org.freedesktop.Telepathy.Connection.Interface.Cellular", "org.freedesktop.Telepathy.Connection.Interface.Anonymity", "com.nokia.Telepathy.Connection.Interface.StoredMessages"}]}]) diff --git a/src/src.pro b/src/src.pro index a0b7ed3..597e8b5 100755 --- a/src/src.pro +++ b/src/src.pro @@ -2,38 +2,64 @@ TEMPLATE = subdirs CONFIG += ordered SUBDIRS += vicar-lib SUBDIRS += vicar-daemon -SUBDIRS += vicar-config + +contains(MEEGO_EDITION,harmattan){ + SUBDIRS += vicar-config-qml +} +else{ + SUBDIRS += vicar-config +} + SUBDIRS += vicar-telepathy SUBDIRS += vicar-utils #MAKE INSTALL -INSTALLS += desktop service manager profile icon26 icon32 icon48 icon64 scalable +INSTALLS += desktop dbus_service tp_connmanager rtcom_profile icon26 icon32 icon48 icon64 appicon + +dbus_service.path = /usr/share/dbus-1/services +dbus_service.files = data/dbus/org.maemo.vicar.service +dbus_service.files += data/dbus/org.freedesktop.Telepathy.ConnectionManager.vicar.service + +tp_connmanager.path = /usr/share/telepathy/managers +tp_connmanager.files = data/telepathy/vicar.manager + +rtcom_profile.path = /usr/share/osso-rtcom +rtcom_profile.files = data/telepathy/vicar.profile + +icon26.path = /usr/share/icons/hicolor/26x26/apps +icon26.files += data/icons/26x26/vicar_harmattan.png + +icon32.path = /usr/share/icons/hicolor/32x32/apps +icon32.files += data/icons/32x32/vicar_harmattan.png -desktop.path = /usr/share/applications/hildon -desktop.files += data/vicar-config.desktop +icon48.path = /usr/share/icons/hicolor/48x48/apps +icon48.files += data/icons/48x48/vicar_harmattan.png -service.path = /usr/share/dbus-1/services -service.files = data/org.maemo.vicar.service -service.files += data/org.freedesktop.Telepathy.ConnectionManager.vicar.service +icon64.path = /usr/share/icons/hicolor/64x64/apps +icon64.files += data/icons/64x64/vicar_harmattan.png -manager.path = /usr/share/telepathy/managers -manager.files = data/vicar.manager +appicon.path = /usr/share/icons/hicolor/80x80/apps +appicon.files += data/icons/vicar_harmattan.png -profile.path = /usr/share/osso-rtcom -profile.files = data/vicar.profile +contains(MEEGO_EDITION,harmattan){ +#Install files required for Harmattan Accounts framework + INSTALLS += account_provider account_service account_icon -icon26.path = /opt/usr/share/icons/hicolor/26x26/apps -icon26.files += data/icons/26x26/vicar_phone.png + account_provider.path = /usr/share/accounts/providers + account_provider.files += data/accounts/vicar.provider -icon32.path = /opt/usr/share/icons/hicolor/32x32/apps -icon32.files += data/icons/32x32/vicar_phone.png + account_service.path = /usr/share/accounts/services + account_service.files += data/accounts/vicar.service -icon48.path = /opt/usr/share/icons/hicolor/48x48/apps -icon48.files += data/icons/48x48/vicar_phone.png + account_icon.path = /usr/share/themes/blanco/meegotouch/icons + account_icon.files += data/icons/icon-m-service-vicar.png -icon64.path = /opt/usr/share/icons/hicolor/64x64/apps -icon64.files += data/icons/64x64/vicar_phone.png + desktop.path = /usr/share/applications + desktop.files += data/desktop/vicar-config-qml.desktop +} -scalable.path = /opt/usr/share/icons/hicolor/scalable/apps -scalable.files += data/icons/vicar_scalable_icon.png +maemo5 | exists(/usr/bin/hildon-home) { + desktop.path = /usr/share/applications/hildon + desktop.files += data/desktop/vicar-config.desktop +} diff --git a/src/vicar-config-qml/cpp/main.cpp b/src/vicar-config-qml/cpp/main.cpp new file mode 100644 index 0000000..6dbb4fe --- /dev/null +++ b/src/vicar-config-qml/cpp/main.cpp @@ -0,0 +1,27 @@ +#include +#include +#include +#include "qmlapplicationviewer.h" +#include + +Q_DECL_EXPORT int main(int argc, char *argv[]) +{ + QScopedPointer app(createApplication(argc, argv)); + QScopedPointer viewer(QmlApplicationViewer::create()); + +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + //For maemo fremantle or harmattan use a common path + qDebug() << "Maemo"; + QString strPath = QDir().homePath() + "/.vicar/OfflineStorage"; + viewer->engine()->setOfflineStoragePath(strPath); +#else + qDebug() << "Not Maemo"; +#endif + + qDebug() << viewer->engine()->offlineStoragePath(); + viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer->setMainQmlFile(QLatin1String("qml/vicarconfigqml/main.qml")); + viewer->showExpanded(); + + return app->exec(); +} diff --git a/src/vicar-config-qml/qml/vicarconfigqml/Library/js/CoreLogic.js b/src/vicar-config-qml/qml/vicarconfigqml/Library/js/CoreLogic.js new file mode 100644 index 0000000..b11d652 --- /dev/null +++ b/src/vicar-config-qml/qml/vicarconfigqml/Library/js/CoreLogic.js @@ -0,0 +1,69 @@ +/* +@version: 0.2 +@author: Sudheer K. +@license: GNU General Public License +*/ + + +var dynComponent; +var addRuleSheet; +var action; + +function loadRules(){ + rulesModel.clear(); + var rulesArray = DBUtility.getAllRules(); + if (rulesArray && rulesArray.length > 0){ + var i; + for (i = 0; i < rulesArray.length; i++){ + var ruleObj = rulesArray[i]; + rulesModel.append({"id":ruleObj.id,"numberpattern":ruleObj.numberpattern,"gatewaynumber":ruleObj.gatewaynumber,"dtmfformat":ruleObj.dtmfformat,"dtmfprefix":ruleObj.dtmfprefix,"dtmfsuffix":ruleObj.dtmfsuffix}); + } + uiLoader.sourceComponent = rulesComponent; + } + else{ + uiLoader.sourceComponent = blankComponent; + } +} + +function editRule(ruleID){ + action = "EDIT"; + dynComponent = Qt.createComponent("addrulesheet.qml"); + if (dynComponent.status == Component.Error) { + console.log("Error loading component:", dynComponent.errorString()); + } + + addRuleSheet = dynComponent.createObject(pageStack.currentPage,{"ruleID": ruleID}); + if (addRuleSheet === null){ + console.log("Error creating object"); + } + else{ + addRuleSheet.statusChanged.connect(onSheetStatusChanged); + addRuleSheet.open(); + } +} + +function addRule(){ + action = "ADD"; + dynComponent = Qt.createComponent("addrulesheet.qml"); + if (dynComponent.status == Component.Error) { + console.log("Error loading component:", dynComponent.errorString()); + } + + addRuleSheet = dynComponent.createObject(pageStack.currentPage); + if (addRuleSheet === null){ + console.log("Error creating object"); + } + else{ + addRuleSheet.statusChanged.connect(onSheetStatusChanged); + addRuleSheet.open(); + } +} + +function onSheetStatusChanged(){ + if (addRuleSheet.status == DialogStatus.Closed){ + if (action == "EDIT") + loadRules(); + else + mainPage.reload(); + } +} diff --git a/src/vicar-config-qml/qml/vicarconfigqml/Library/js/DBUtility.js b/src/vicar-config-qml/qml/vicarconfigqml/Library/js/DBUtility.js new file mode 100644 index 0000000..0583583 --- /dev/null +++ b/src/vicar-config-qml/qml/vicarconfigqml/Library/js/DBUtility.js @@ -0,0 +1,206 @@ +/* +@version: 0.2 +@author: Sudheer K. +@license: GNU General Public License +*/ + +function getDatabase() { + logMessage("Opening VICaR database.."); + return openDatabaseSync("VICaR", "1.0", "StorageDatabase", 100); +} + +function logMessage(strMessage){ + if (typeof(logUtility)!== 'undefined'){ + logUtility.logMessage(strMessage); + } + else{ + console.log(strMessage); + } +} + +// Initialize tables +function initialize() { + var db = getDatabase(); + db.transaction( + function(tx) { + // Create the settings table if it doesn't already exist + // If the table exists, this is skipped + tx.executeSql('CREATE TABLE IF NOT EXISTS settings(setting TEXT PRIMARY KEY, value TEXT)'); + tx.executeSql('CREATE TABLE IF NOT EXISTS rules(id INTEGER PRIMARY KEY, numberpattern TEXT, gatewaynumber TEXT, dtmfformat TEXT, dtmfprefix TEXT, dtmfsuffix TEXT)'); + }, + function(error) { + logMessage("Error ["+error.code +"] - " + error.DOMString+" occurred."); + }); +} + +function getSetting(setting) { + var db = getDatabase(); + var res=""; + db.transaction( + function(tx) { + var rs = tx.executeSql('SELECT value FROM settings WHERE setting=?;', [setting]); + if (rs.rows.length > 0) { + res = rs.rows.item(0).value; + logMessage(setting+" is "+res); + } else { + res = "Unknown"; + } + }, + function(error) { + logMessage("Error ["+error.code +"] - " + error.DOMString+" occurred."); + } + ); + return res; +} + + +function setSetting(setting, value) { + var db = getDatabase(); + var res = ""; + db.transaction( + function(tx) { + var rs = tx.executeSql('INSERT OR REPLACE INTO settings VALUES (?,?);', [setting,value]); + if (rs.rowsAffected > 0) { + res = "OK"; + logMessage("Updated "+setting+" to "+value); + } else { + res = "Error"; + } + }, + function(error) { + logMessage("Error ["+error.code +"] - " + error.DOMString+" occurred."); + } + ); + return res; +} + +function addRule(ruleObj){ + logMessage('SQL> INSERT INTO rules(id, numberpattern, gatewaynumber, dtmfformat, dtmfprefix, dtmfsuffix) VALUES (NULL, '+[ruleObj.numberpattern, ruleObj.gatewaynumber, ruleObj.dtmfformat, ruleObj.dtmfprefix, ruleObj.dtmfsuffix]+')'); + var db = getDatabase(); + var res = ""; + logMessage("Opened VICaR database.."); + + db.transaction(function(tx) { + var rs = tx.executeSql('INSERT INTO rules(id, numberpattern, gatewaynumber, dtmfformat, dtmfprefix, dtmfsuffix) VALUES (NULL, ?, ?, ?, ?, ?);', [ruleObj.numberpattern, ruleObj.gatewaynumber, ruleObj.dtmfformat, ruleObj.dtmfprefix, ruleObj.dtmfsuffix]); + logMessage("Inserted "+rs.rowsAffected+" rows"); + if (rs.rowsAffected > 0) { + res = "OK"; + } else { + res = "Error"; + } + }, + function(error) { + logMessage("Error ["+error.code +"] - " + error.DOMString+" occurred."); + } + ); + return res; +} + +function updateRule(id,ruleObj){ + logMessage('SQL> UPDATE rules set numberpattern = '+[ruleObj.numberpattern]+ + ', gatewaynumber = '+[ruleObj.gatewaynumber]+ + ', dtmfformat = '+[ruleObj.dtmfformat]+ + ', dtmfprefix = '+[ruleObj.dtmfprefix]+ + ', dtmfsuffix = '+[ruleObj.dtmfsuffix]+ + ' WHERE id = ?'+[id]); + var db = getDatabase(); + var res = ""; + db.transaction(function(tx) { + var rs = tx.executeSql('UPDATE rules set numberpattern = ?, gatewaynumber = ?, dtmfformat = ?, dtmfprefix = ?, dtmfsuffix = ? WHERE id = ?;', + [ruleObj.numberpattern, ruleObj.gatewaynumber, ruleObj.dtmfformat, ruleObj.dtmfprefix, ruleObj.dtmfsuffix, id]); + logMessage("Updated "+rs.rowsAffected+" rows"); + if (rs.rowsAffected > 0) { + res = "OK"; + } else { + res = "Error"; + } + }, + function(error) { + logMessage("Error ["+error.code +"] - " + error.DOMString+" occurred."); + } + ); + return res; +} + +function removeRule(id){ + logMessage('SQL> DELETE FROM rules WHERE id = '+[id]); + var db = getDatabase(); + var res = ""; + db.transaction(function(tx) { + var rs = tx.executeSql('DELETE FROM rules WHERE id = ?;', [id]); + logMessage("Deleted "+rs.rowsAffected+" rows"); + if (rs.rowsAffected > 0) { + res = "OK"; + } else { + res = "Error"; + } + }, + function(error) { + logMessage("Error ["+error.code +"] - " + error.DOMString+" occurred."); + } + ); + return res; +} + +function getAllRules(){ + var db = getDatabase(); + var rulesArray = new Array(); + var ruleObj; + db.transaction(function(tx) { + var rs = tx.executeSql('SELECT * FROM rules'); + logMessage("Fetched "+rs.rows.length+" rows"); + var i = 0; + for (i = 0; i < rs.rows.length; i++){ + ruleObj = new Object(); + ruleObj.id = rs.rows.item(i).id; + ruleObj.numberpattern = rs.rows.item(i).numberpattern; + ruleObj.gatewaynumber = rs.rows.item(i).gatewaynumber; + ruleObj.dtmfformat = rs.rows.item(i).dtmfformat; + ruleObj.dtmfprefix = rs.rows.item(i).dtmfprefix; + ruleObj.dtmfsuffix = rs.rows.item(i).dtmfsuffix; + rulesArray[i] = ruleObj; + logMessage("id = "+ruleObj.id + +", numberpattern = "+ruleObj.numberpattern + +", gatewaynumber = "+ruleObj.gatewaynumber + +", dtmfformat = "+ruleObj.dtmfformat + +", dtmfprefix = "+ruleObj.dtmfprefix + +", dtmfsuffix = "+ruleObj.dtmfsuffix); + } + }, + function(error) { + logMessage("Error ["+error.code +"] - " + error.DOMString+" occurred."); + } + ); + return rulesArray; +} + + +function getRuleByID(id){ + var db = getDatabase(); + var ruleObj; + db.transaction(function(tx) { + logMessage('SQL> SELECT * FROM rules WHERE id = '+[id]); + var rs = tx.executeSql('SELECT * FROM rules WHERE id = '+[id]); + logMessage("Fetched "+rs.rows.length+" rows"); + if (rs.rows.length > 0){ + ruleObj = new Object(); + ruleObj.id = rs.rows.item(0).id; + ruleObj.numberpattern = rs.rows.item(0).numberpattern; + ruleObj.gatewaynumber = rs.rows.item(0).gatewaynumber; + ruleObj.dtmfformat = rs.rows.item(0).dtmfformat; + ruleObj.dtmfprefix = rs.rows.item(0).dtmfprefix; + ruleObj.dtmfsuffix = rs.rows.item(0).dtmfsuffix; + logMessage("id = "+ruleObj.id + +", numberpattern = "+ruleObj.numberpattern + +", gatewaynumber = "+ruleObj.gatewaynumber + +", dtmfformat = "+ruleObj.dtmfformat + +", dtmfprefix = "+ruleObj.dtmfprefix + +", dtmfsuffix = "+ruleObj.dtmfsuffix); + } + }, + function(error) { + logMessage("Error ["+error.code +"] - " + error.DOMString+" occurred."); + } + ); + return ruleObj; +} diff --git a/src/vicar-config-qml/qml/vicarconfigqml/MainPage.qml b/src/vicar-config-qml/qml/vicarconfigqml/MainPage.qml new file mode 100644 index 0000000..2237915 --- /dev/null +++ b/src/vicar-config-qml/qml/vicarconfigqml/MainPage.qml @@ -0,0 +1,112 @@ +import QtQuick 1.1 +import com.nokia.meego 1.0 +import "Library/js/DBUtility.js" as DBUtility +import "Library/js/CoreLogic.js" as Core + +Page { + tools: commonTools + id: mainPage + + Component.onCompleted: { + DBUtility.initialize(); + Core.loadRules(); + } + + function reload(){ + Core.loadRules(); + } + + Rectangle{ + id: headerRect + anchors.top:parent.top + width: parent.width ; height: parent.height/10 + color: "grey" + opacity: 0.6 + + Text { + id: titleText + anchors.centerIn: parent //#cccccc + font.pointSize: 16; horizontalAlignment: Text.AlignLeft; elide: Text.ElideLeft; color: "black"; style: Text.Raised; styleColor: "black" + font.bold: true + text: qsTr("VICaR - Rules") + } + } + + Loader + { + id: uiLoader + anchors {top: headerRect.bottom; bottom: parent.bottom} + width: parent.width + } + + ListModel{ + id: rulesModel + } + + + Component { + id: rulesComponent + Item { + ListView { + id: rulesView + model: rulesModel + anchors.fill: parent + delegate:ruleDelegate + } + } + } + + Component { + id: ruleDelegate + Item{ + width: uiLoader.width + height: 40 + Text { + width: parent.width + font.pointSize: 16; horizontalAlignment: Text.AlignLeft; elide: Text.ElideLeft; color: "black"; style: Text.Raised; styleColor: "black" + text: "For #s starting with "+numberpattern+ ", use "+gatewaynumber; + } + MouseArea{ + anchors.fill: parent + onPressAndHold: { + ruleContextMenu.ruleID = id; + console.log("Setting Rule ID as "+id); + ruleContextMenu.open(); + } + } + } + } + + ContextMenu{ + id: ruleContextMenu + property int ruleID:0 + + MenuLayout{ + MenuItem { + text: qsTr("Edit"); + onClicked: { + Core.editRule(ruleContextMenu.ruleID); + } + } + MenuItem { + text: qsTr("Delete"); + onClicked: { + DBUtility.removeRule(ruleContextMenu.ruleID); + Core.loadRules(); + } + } + } + } + + Component{ + id: blankComponent + Item { + Label { + id: label + anchors.centerIn: parent + text: qsTr("Add rules for call routing.") + visible: true + } + } + } +} diff --git a/src/vicar-config-qml/qml/vicarconfigqml/addrulesheet.qml b/src/vicar-config-qml/qml/vicarconfigqml/addrulesheet.qml new file mode 100644 index 0000000..321950e --- /dev/null +++ b/src/vicar-config-qml/qml/vicarconfigqml/addrulesheet.qml @@ -0,0 +1,146 @@ +import QtQuick 1.1 +import com.nokia.meego 1.0 +import "Library/js/DBUtility.js" as DBUtility + +Sheet{ + id: screen + acceptButtonText: qsTr("Done") + rejectButtonText: qsTr("Cancel") + + signal sheetDestroyed() + + property int ruleID:0 + property string numberpattern:"" + property string gatewaynumber:"" + property string dtmfformat:"" + property int numberFormatIndex:0 + property string dtmfprefix: "" + property string dtmfsuffix: "" + + Component.onCompleted: { + if (ruleID != 0){ + var ruleObj = DBUtility.getRuleByID(ruleID); + if (ruleObj !== null){ + numberpattern = ruleObj.numberpattern; + gatewaynumber = ruleObj.gatewaynumber; + dtmfformat = ruleObj.dtmfformat; + var i; + for (i = 0; i < numberFormatModel.count; i++){ + if (numberFormatModel.get(i).name == dtmfformat) { + numberFormatIndex = i; + break; + } + } + dtmfprefix = ruleObj.dtmfprefix; + dtmfsuffix = ruleObj.dtmfsuffix; + } + } + } + + Component.onDestruction: { + console.log("OnDestruction"); + sheetDestroyed(); + } + + ListModel { + id: numberFormatModel + ListElement { name: "" } + ListElement { name: "+" } + ListElement { name: "00" } + ListElement { name: "011" } + } + + SelectionDialog { + id: numberFormatDialog + titleText: "Number Format" + width: container.width + selectedIndex: numberFormatIndex + model: numberFormatModel + } + + content: Flickable { + id: container + anchors.fill: parent + anchors.leftMargin: 10 + anchors.topMargin: 10 + flickableDirection: Flickable.VerticalFlick + + Column { + id: col + width: parent.width + spacing: 10 + Label { text: (ruleID != 0)? qsTr("Edit Rule"):qsTr("Add Rule"); font.bold: true; } + Label { text: qsTr("For numbers starting with:") } + TextField { + id: numberStartingWith + anchors { left: parent.left; right: parent.right; } + //height: implicitHeight + inputMethodHints: Qt.ImhDialableCharactersOnly | Qt.ImhNoPredictiveText + text: screen.numberpattern + } + Label { text: qsTr("Route call via:") } + TextField { + id: gatewayNumber + anchors { left: parent.left; right: parent.right; } + //height: implicitHeight + inputMethodHints: Qt.ImhDialableCharactersOnly | Qt.ImhNoPredictiveText + text: screen.gatewaynumber + } + + Label { text: qsTr("Dial number in this format:") } + + Button { + anchors { horizontalCenter: parent.horizontalCenter } + //height: implicitHeight + text: "Change Format" + onClicked: { + numberFormatDialog.open(); + } + } + + Rectangle { + width: parent.width + height: 30 + color: "lightgray" + Text { + anchors.horizontalCenter: parent.horizontalCenter + text: numberFormatDialog.selectedIndex >= 0 ? numberFormatDialog.model.get(numberFormatDialog.selectedIndex).name : "None" + font.pixelSize: 16 + //font.bold: true + } + } + + Label { text: qsTr("Include this tone before dialing:") } + TextField { + id: dtmfPrefix + anchors { left: parent.left; right: parent.right; } + height: implicitHeight + inputMethodHints: Qt.ImhDialableCharactersOnly | Qt.ImhNoPredictiveText + } + + Label { text: qsTr("Include this tone after dialing:") } + TextField { + id: dtmfSuffix + anchors { left: parent.left; right: parent.right; } + height: implicitHeight + inputMethodHints: Qt.ImhDialableCharactersOnly | Qt.ImhNoPredictiveText + } + } + } + onAccepted: { + //id, numberpattern, gatewaynumber, dtmfformat, dtmfprefix, dtmfsuffix + var ruleObj = new Object(); + ruleObj.id = ruleID; + ruleObj.numberpattern = numberStartingWith.text; + ruleObj.gatewaynumber = gatewayNumber.text; + ruleObj.dtmfformat = numberFormatDialog.model.get(numberFormatDialog.selectedIndex).name; + ruleObj.dtmfprefix = dtmfPrefix.text; + ruleObj.dtmfsuffix = dtmfSuffix.text; + if (ruleID != 0) + DBUtility.updateRule(ruleID,ruleObj); + else + DBUtility.addRule(ruleObj); + destroy(); + } + onRejected: destroy(); +} diff --git a/src/vicar-config-qml/qml/vicarconfigqml/main.qml b/src/vicar-config-qml/qml/vicarconfigqml/main.qml new file mode 100644 index 0000000..8dbf557 --- /dev/null +++ b/src/vicar-config-qml/qml/vicarconfigqml/main.qml @@ -0,0 +1,40 @@ +import QtQuick 1.1 +import com.nokia.meego 1.0 +import "Library/js/CoreLogic.js" as Core + +PageStackWindow { + id: appWindow + + initialPage: mainPage + + MainPage { + id: mainPage + } + + ToolBarLayout { + id: commonTools + visible: true + + ToolIcon { + platformIconId: "toolbar-add" + anchors.left: (parent === undefined) ? undefined : parent.left + onClicked: { + Core.addRule(); + } + } + + ToolIcon { + platformIconId: "toolbar-view-menu" + anchors.right: (parent === undefined) ? undefined : parent.right + onClicked: (myMenu.status == DialogStatus.Closed) ? myMenu.open() : myMenu.close() + } + } + + Menu { + id: myMenu + visualParent: pageStack + MenuLayout { + MenuItem { text: qsTr("About") } + } + } +} diff --git a/src/vicar-config-qml/qmlapplicationviewer/qmlapplicationviewer.cpp b/src/vicar-config-qml/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..8ba6e88 --- /dev/null +++ b/src/vicar-config-qml/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,200 @@ +// checksum 0x78c version 0x60010 +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include +#include +#include +#include +#include +#include + +#include // MEEGO_EDITION_HARMATTAN + +#ifdef HARMATTAN_BOOSTER +#include +#endif + +#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 + +#include + +#if !defined(NO_JSDEBUGGER) +#include +#endif +#if !defined(NO_QMLOBSERVER) +#include +#endif + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QmlApplicationViewerPrivate(QDeclarativeView *view_) : view(view_) {} + + QString mainQmlFile; + QDeclarativeView *view; + friend class QmlApplicationViewer; + QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + QString pathInInstallDir; + const QString applicationDirPath = QCoreApplication::applicationDirPath(); + pathInInstallDir = QString::fromAscii("%1/../%2").arg(applicationDirPath, path); + + if (QFileInfo(pathInInstallDir).exists()) + return pathInInstallDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) + : QDeclarativeView(parent) + , d(new QmlApplicationViewerPrivate(this)) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); + // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in +#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 +#if !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(d->view->engine()); +#endif +#if !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view); +#endif +#endif +} + +QmlApplicationViewer::QmlApplicationViewer(QDeclarativeView *view, QWidget *parent) + : QDeclarativeView(parent) + , d(new QmlApplicationViewerPrivate(view)) +{ + connect(view->engine(), SIGNAL(quit()), view, SLOT(close())); + view->setResizeMode(QDeclarativeView::SizeRootObjectToView); + // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in +#if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 +#if !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(d->view->engine()); +#endif +#if !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view); +#endif +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete d; +} + +QmlApplicationViewer *QmlApplicationViewer::create() +{ +#ifdef HARMATTAN_BOOSTER + return new QmlApplicationViewer(MDeclarativeCache::qDeclarativeView(), 0); +#else + return new QmlApplicationViewer(); +#endif +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + d->mainQmlFile = d->adjustPath(file); + d->view->setSource(QUrl::fromLocalFile(d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + d->view->engine()->addImportPath(d->adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +#if defined(Q_OS_SYMBIAN) + // If the version of Qt on the device is < 4.7.2, that attribute won't work + if (orientation != ScreenOrientationAuto) { + const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); + if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { + qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); + return; + } + } +#endif // Q_OS_SYMBIAN + + Qt::WidgetAttribute attribute; + switch (orientation) { +#if QT_VERSION < 0x040702 + // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes + case ScreenOrientationLockPortrait: + attribute = static_cast(128); + break; + case ScreenOrientationLockLandscape: + attribute = static_cast(129); + break; + default: + case ScreenOrientationAuto: + attribute = static_cast(130); + break; +#else // QT_VERSION < 0x040702 + case ScreenOrientationLockPortrait: + attribute = Qt::WA_LockPortraitOrientation; + break; + case ScreenOrientationLockLandscape: + attribute = Qt::WA_LockLandscapeOrientation; + break; + default: + case ScreenOrientationAuto: + attribute = Qt::WA_AutoOrientation; + break; +#endif // QT_VERSION < 0x040702 + }; + setAttribute(attribute, true); +} + +void QmlApplicationViewer::showExpanded() +{ +#if defined(Q_OS_SYMBIAN) || defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) + d->view->showFullScreen(); +#elif defined(Q_WS_MAEMO_5) + d->view->showMaximized(); +#else + d->view->show(); +#endif +} + +QApplication *createApplication(int &argc, char **argv) +{ +#ifdef HARMATTAN_BOOSTER + return MDeclarativeCache::qApplication(argc, argv); +#else + return new QApplication(argc, argv); +#endif +} diff --git a/src/vicar-config-qml/qmlapplicationviewer/qmlapplicationviewer.h b/src/vicar-config-qml/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..f8008f5 --- /dev/null +++ b/src/vicar-config-qml/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,47 @@ +// checksum 0x82ed version 0x60010 +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + static QmlApplicationViewer *create(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + + // Note that this will only have an effect on Symbian and Fremantle. + void setOrientation(ScreenOrientation orientation); + + void showExpanded(); + +private: + explicit QmlApplicationViewer(QDeclarativeView *view, QWidget *parent); + class QmlApplicationViewerPrivate *d; +}; + +QApplication *createApplication(int &argc, char **argv); + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/src/vicar-config-qml/qmlapplicationviewer/qmlapplicationviewer.pri b/src/vicar-config-qml/qmlapplicationviewer/qmlapplicationviewer.pri new file mode 100644 index 0000000..1b90206 --- /dev/null +++ b/src/vicar-config-qml/qmlapplicationviewer/qmlapplicationviewer.pri @@ -0,0 +1,146 @@ +# checksum 0x368d version 0x60010 +# This file was generated by the Qt Quick Application wizard of Qt Creator. +# The code below adds the QmlApplicationViewer to the project and handles the +# activation of QML debugging. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +QT += declarative + +SOURCES += $$PWD/qmlapplicationviewer.cpp +HEADERS += $$PWD/qmlapplicationviewer.h +INCLUDEPATH += $$PWD + +# Include JS debugger library if QMLJSDEBUGGER_PATH is set +!isEmpty(QMLJSDEBUGGER_PATH) { + include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) +} else { + DEFINES -= QMLJSDEBUGGER +} + +contains(CONFIG,qdeclarative-boostable):contains(MEEGO_EDITION,harmattan) { + DEFINES += HARMATTAN_BOOSTER +} +# This file was generated by an application wizard of Qt Creator. +# The code below handles deployment to Symbian and Maemo, aswell as copying +# of the application data to shadow build directories on desktop. +# It is recommended not to modify this file, since newer versions of Qt Creator +# may offer an updated version of it. + +defineTest(qtcAddDeployment) { +for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemsources = $${item}.sources + $$itemsources = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath= $$eval($${deploymentfolder}.target) + export($$itemsources) + export($$itempath) + DEPLOYMENT += $$item +} + +MAINPROFILEPWD = $$PWD + +symbian { + isEmpty(ICON):exists($${TARGET}.svg):ICON = $${TARGET}.svg + isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 +} else:win32 { + copyCommand = + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) + source = $$replace(source, /, \\) + sourcePathSegments = $$split(source, \\) + target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments) + target = $$replace(target, /, \\) + !isEqual(source,$$target) { + !isEmpty(copyCommand):copyCommand += && + isEqual(QMAKE_DIR_SEP, \\) { + copyCommand += $(COPY_DIR) \"$$source\" \"$$target\" + } else { + source = $$replace(source, \\\\, /) + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + target = $$replace(target, \\\\, /) + copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\" + } + } + } + !isEmpty(copyCommand) { + copyCommand = @echo Copying application data... && $$copyCommand + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } +} else:unix { + maemo5 { + desktopfile.files = $${TARGET}.desktop + desktopfile.path = /usr/share/applications/hildon + icon.files = $${TARGET}64.png + icon.path = /usr/share/icons/hicolor/64x64/apps + } else:!isEmpty(MEEGO_VERSION_MAJOR) { + desktopfile.files = $${TARGET}_harmattan.desktop + desktopfile.path = /usr/share/applications + icon.files = $${TARGET}80.png + icon.path = /usr/share/icons/hicolor/80x80/apps + } else { # Assumed to be a Desktop Unix + copyCommand = + for(deploymentfolder, DEPLOYMENTFOLDERS) { + source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) + source = $$replace(source, \\\\, /) + macx { + target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) + } else { + target = $$OUT_PWD/$$eval($${deploymentfolder}.target) + } + target = $$replace(target, \\\\, /) + sourcePathSegments = $$split(source, /) + targetFullPath = $$target/$$last(sourcePathSegments) + !isEqual(source,$$targetFullPath) { + !isEmpty(copyCommand):copyCommand += && + copyCommand += $(MKDIR) \"$$target\" + copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\" + } + } + !isEmpty(copyCommand) { + copyCommand = @echo Copying application data... && $$copyCommand + copydeploymentfolders.commands = $$copyCommand + first.depends = $(first) copydeploymentfolders + export(first.depends) + export(copydeploymentfolders.commands) + QMAKE_EXTRA_TARGETS += first copydeploymentfolders + } + } + installPrefix = /opt/$${TARGET} + for(deploymentfolder, DEPLOYMENTFOLDERS) { + item = item$${deploymentfolder} + itemfiles = $${item}.files + $$itemfiles = $$eval($${deploymentfolder}.source) + itempath = $${item}.path + $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target) + export($$itemfiles) + export($$itempath) + INSTALLS += $$item + } + + !isEmpty(desktopfile.path) { + export(icon.files) + export(icon.path) + export(desktopfile.files) + export(desktopfile.path) + INSTALLS += icon desktopfile + } + + target.path = $${installPrefix}/bin + export(target.path) + INSTALLS += target +} + +export (ICON) +export (INSTALLS) +export (DEPLOYMENT) +export (TARGET.EPOCHEAPSIZE) +export (TARGET.CAPABILITY) +export (LIBS) +export (QMAKE_EXTRA_TARGETS) +} diff --git a/src/vicar-config-qml/vicar-config-qml.pro b/src/vicar-config-qml/vicar-config-qml.pro new file mode 100644 index 0000000..df37cd4 --- /dev/null +++ b/src/vicar-config-qml/vicar-config-qml.pro @@ -0,0 +1,25 @@ +contains(MEEGO_EDITION,harmattan){ + DEFINES += Q_WS_MAEMO_6 +} + +# Add more folders to ship with the application, here +folder_01.source = qml/vicarconfigqml +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +INCLUDEPATH += /usr/include/applauncherd + +# Speed up launching on MeeGo/Harmattan when using applauncherd daemon +CONFIG += qt-boostable qdeclarative-boostable +LIBS += -lmdeclarativecache + +# The .cpp file which was generated for your project. Feel free to hack it. +SOURCES += cpp/main.cpp + +VPATH += cpp +MOC_DIR = cpp/.mocs +OBJECTS_DIR = cpp/.objs + +# Please do not modify the following two lines. Required for deployment. +include(qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/src/vicar-config/cpp/main.cpp b/src/vicar-config/cpp/main.cpp new file mode 100755 index 0000000..d451c35 --- /dev/null +++ b/src/vicar-config/cpp/main.cpp @@ -0,0 +1,21 @@ +/* +@version: 0.6 +@author: Sudheer K. +@license: GNU General Public License +*/ + + +#include +#include "profileswindow.h" +#include "vicarprofiletypes.h" + +int main(int argc, char *argv[]) +{ + //qDBusRegisterMetaType(); + //qDBusRegisterMetaType(); + + QApplication a(argc, argv); + ProfilesWindow w; + w.show(); + return a.exec(); +} diff --git a/src/vicar-config/cpp/profilesettingsdialog.cpp b/src/vicar-config/cpp/profilesettingsdialog.cpp new file mode 100644 index 0000000..a0c827d --- /dev/null +++ b/src/vicar-config/cpp/profilesettingsdialog.cpp @@ -0,0 +1,85 @@ +/* +@version: 0.6 +@author: Sudheer K. +@license: GNU General Public License +*/ + +#include "profilesettingsdialog.h" +#include "ui_profilesettingsdialog.h" +#include "vicarprofiletypes.h" +#include +#include + +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 + + if (profile->phoneNumberPattern == "%"){ + ui->labelNumberStartsWith->setText("-- Default Profile --"); + ui->lineEditNumberStartsWith->setVisible(false); + } + + 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->lineEditCallingCardNumber->setValidator(new QRegExpValidator(QRegExp( "^[0-9\\+]*$"), 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/cpp/profilesettingsdialog.h b/src/vicar-config/cpp/profilesettingsdialog.h new file mode 100644 index 0000000..afbabc5 --- /dev/null +++ b/src/vicar-config/cpp/profilesettingsdialog.h @@ -0,0 +1,33 @@ +/* +@version: 0.6 +@author: Sudheer K. +@license: GNU General Public License +*/ +#ifndef PROFILESETTINGSDIALOG_H +#define PROFILESETTINGSDIALOG_H + +#include +#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/cpp/profileswindow.cpp b/src/vicar-config/cpp/profileswindow.cpp new file mode 100644 index 0000000..88fdfdd --- /dev/null +++ b/src/vicar-config/cpp/profileswindow.cpp @@ -0,0 +1,253 @@ +/* +@version: 0.6 +@author: Sudheer K. +@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 +#include + +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{ + org::maemo::vicar::Profile currentProfile; + QString strProfileDetails; + QListWidgetItem *item; + foreach (currentProfile,profileList){ + if (currentProfile.phoneNumberPattern != "%"){ + strProfileDetails = QString("Number starts with %1, then call via %2") + .arg(currentProfile.phoneNumberPattern) + .arg(currentProfile.gatewayNumber); + } + else{ + strProfileDetails = QString("No profile found, then call via %1") + .arg(currentProfile.gatewayNumber); + } + 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; + if (profile.phoneNumberPattern != "%"){ + strProfileDetails = QString("Number starts with %1, then call via %2") + .arg(profile.phoneNumberPattern) + .arg(profile.gatewayNumber); + } + else{ + strProfileDetails = QString("No profile found, then call via %1") + .arg(profile.gatewayNumber); + } + item->setText(strProfileDetails); + item->setData(Qt::UserRole,profile.profileID); + } + } + } + } + else{ + d->dbusUtility->displayNotification("Select a profile to edit."); + } +} + +void ProfilesWindow::on_removeButton_clicked(){ + QListWidgetItem *item = ui->profilesListWidget->currentItem(); + if (item != 0){ + qDebug() << "Selected item data is " << item->data(Qt::UserRole).toInt(); + 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(); + + 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); +} + +void ProfilesWindow::on_actionEditDefaultProfile_triggered(){ + org::maemo::vicar::Profile profile; + bool result = d->databaseUtility->getDefaultProfile(&profile); + qDebug() << "Default profile exits? " <exec(); + if (response == QDialog::Accepted){ + qDebug() << "Updating default profile record"; + bool result = d->databaseUtility->updateProfile(profile); + if (!result){ + d->dbusUtility->displayNotification("Unable to update default profile."); + qDebug() << "Error updating default profile."<< d->databaseUtility->lastError(); + } + else{ + ui->profilesListWidget->clear(); + this->loadProfilesList(); + } + } + } + else{ + //Create new default profile + profile.phoneNumberPattern = "%"; + ProfileSettingsDialog *dialog = new ProfileSettingsDialog(this,&profile); + int result = dialog->exec(); + if (result == QDialog::Accepted){ + qDebug() << "Inserting new default profile record"; + int result = d->databaseUtility->insertProfile(profile); + if (result == -1){ + d->dbusUtility->displayNotification("Unable to create default profile."); + qDebug() << "Error inserting new default profile record. "<< d->databaseUtility->lastError(); + } + else{ + QString strProfileDetails = QString("No profile found, then call via %1") + .arg(profile.gatewayNumber); + QListWidgetItem *item = new QListWidgetItem(strProfileDetails,ui->profilesListWidget); + item->setData(Qt::UserRole,result); + } + } + } +} diff --git a/src/vicar-config/cpp/profileswindow.h b/src/vicar-config/cpp/profileswindow.h new file mode 100644 index 0000000..e2981da --- /dev/null +++ b/src/vicar-config/cpp/profileswindow.h @@ -0,0 +1,39 @@ +/* +@version: 0.6 +@author: Sudheer K. +@license: GNU General Public License +*/ +#ifndef PROFILESWINDOW_H +#define PROFILESWINDOW_H + +#include + +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); + void on_actionEditDefaultProfile_triggered(); +}; + +#endif // PROFILESWINDOW_H diff --git a/src/vicar-config/src/main.cpp b/src/vicar-config/src/main.cpp deleted file mode 100755 index d451c35..0000000 --- a/src/vicar-config/src/main.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@license: GNU General Public License -*/ - - -#include -#include "profileswindow.h" -#include "vicarprofiletypes.h" - -int main(int argc, char *argv[]) -{ - //qDBusRegisterMetaType(); - //qDBusRegisterMetaType(); - - QApplication a(argc, argv); - ProfilesWindow w; - w.show(); - return a.exec(); -} diff --git a/src/vicar-config/src/profilesettingsdialog.cpp b/src/vicar-config/src/profilesettingsdialog.cpp deleted file mode 100644 index a0c827d..0000000 --- a/src/vicar-config/src/profilesettingsdialog.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@license: GNU General Public License -*/ - -#include "profilesettingsdialog.h" -#include "ui_profilesettingsdialog.h" -#include "vicarprofiletypes.h" -#include -#include - -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 - - if (profile->phoneNumberPattern == "%"){ - ui->labelNumberStartsWith->setText("-- Default Profile --"); - ui->lineEditNumberStartsWith->setVisible(false); - } - - 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->lineEditCallingCardNumber->setValidator(new QRegExpValidator(QRegExp( "^[0-9\\+]*$"), 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 deleted file mode 100644 index afbabc5..0000000 --- a/src/vicar-config/src/profilesettingsdialog.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@license: GNU General Public License -*/ -#ifndef PROFILESETTINGSDIALOG_H -#define PROFILESETTINGSDIALOG_H - -#include -#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 deleted file mode 100644 index 88fdfdd..0000000 --- a/src/vicar-config/src/profileswindow.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@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 -#include - -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{ - org::maemo::vicar::Profile currentProfile; - QString strProfileDetails; - QListWidgetItem *item; - foreach (currentProfile,profileList){ - if (currentProfile.phoneNumberPattern != "%"){ - strProfileDetails = QString("Number starts with %1, then call via %2") - .arg(currentProfile.phoneNumberPattern) - .arg(currentProfile.gatewayNumber); - } - else{ - strProfileDetails = QString("No profile found, then call via %1") - .arg(currentProfile.gatewayNumber); - } - 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; - if (profile.phoneNumberPattern != "%"){ - strProfileDetails = QString("Number starts with %1, then call via %2") - .arg(profile.phoneNumberPattern) - .arg(profile.gatewayNumber); - } - else{ - strProfileDetails = QString("No profile found, then call via %1") - .arg(profile.gatewayNumber); - } - item->setText(strProfileDetails); - item->setData(Qt::UserRole,profile.profileID); - } - } - } - } - else{ - d->dbusUtility->displayNotification("Select a profile to edit."); - } -} - -void ProfilesWindow::on_removeButton_clicked(){ - QListWidgetItem *item = ui->profilesListWidget->currentItem(); - if (item != 0){ - qDebug() << "Selected item data is " << item->data(Qt::UserRole).toInt(); - 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(); - - 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); -} - -void ProfilesWindow::on_actionEditDefaultProfile_triggered(){ - org::maemo::vicar::Profile profile; - bool result = d->databaseUtility->getDefaultProfile(&profile); - qDebug() << "Default profile exits? " <exec(); - if (response == QDialog::Accepted){ - qDebug() << "Updating default profile record"; - bool result = d->databaseUtility->updateProfile(profile); - if (!result){ - d->dbusUtility->displayNotification("Unable to update default profile."); - qDebug() << "Error updating default profile."<< d->databaseUtility->lastError(); - } - else{ - ui->profilesListWidget->clear(); - this->loadProfilesList(); - } - } - } - else{ - //Create new default profile - profile.phoneNumberPattern = "%"; - ProfileSettingsDialog *dialog = new ProfileSettingsDialog(this,&profile); - int result = dialog->exec(); - if (result == QDialog::Accepted){ - qDebug() << "Inserting new default profile record"; - int result = d->databaseUtility->insertProfile(profile); - if (result == -1){ - d->dbusUtility->displayNotification("Unable to create default profile."); - qDebug() << "Error inserting new default profile record. "<< d->databaseUtility->lastError(); - } - else{ - QString strProfileDetails = QString("No profile found, then call via %1") - .arg(profile.gatewayNumber); - QListWidgetItem *item = new QListWidgetItem(strProfileDetails,ui->profilesListWidget); - item->setData(Qt::UserRole,result); - } - } - } -} diff --git a/src/vicar-config/src/profileswindow.h b/src/vicar-config/src/profileswindow.h deleted file mode 100644 index e2981da..0000000 --- a/src/vicar-config/src/profileswindow.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@license: GNU General Public License -*/ -#ifndef PROFILESWINDOW_H -#define PROFILESWINDOW_H - -#include - -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); - void on_actionEditDefaultProfile_triggered(); -}; - -#endif // PROFILESWINDOW_H diff --git a/src/vicar-config/uis/profilesettingsdialog.ui b/src/vicar-config/uis/profilesettingsdialog.ui index 1f2aff4..e372438 100644 --- a/src/vicar-config/uis/profilesettingsdialog.ui +++ b/src/vicar-config/uis/profilesettingsdialog.ui @@ -36,8 +36,8 @@ 0 0 - 677 - 367 + 679 + 369 @@ -125,7 +125,7 @@ - Qt::ImhDialableCharactersOnly|Qt::ImhLowercaseOnly|Qt::ImhNoPredictiveText|Qt::ImhPreferNumbers + Qt::ImhDialableCharactersOnly|Qt::ImhNoPredictiveText diff --git a/src/vicar-config/uis/ui_profilesettingsdialog.h b/src/vicar-config/uis/ui_profilesettingsdialog.h new file mode 100644 index 0000000..101b4c0 --- /dev/null +++ b/src/vicar-config/uis/ui_profilesettingsdialog.h @@ -0,0 +1,224 @@ +/******************************************************************************** +** Form generated from reading UI file 'profilesettingsdialog.ui' +** +** Created: Mon Jan 2 23:41:01 2012 +** by: Qt User Interface Compiler version 4.7.4 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef UI_PROFILESETTINGSDIALOG_H +#define UI_PROFILESETTINGSDIALOG_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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::ImhDialableCharactersOnly|Qt::ImhLowercaseOnly|Qt::ImhNoPredictiveText|Qt::ImhPreferNumbers); + + 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::ImhDialableCharactersOnly|Qt::ImhNoPredictiveText); + + 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::ImhNoPredictiveText|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::ImhNoPredictiveText|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", "", 0, QApplication::UnicodeUTF8) + << QApplication::translate("ProfileSettingsDialog", "+", 0, QApplication::UnicodeUTF8) + << QApplication::translate("ProfileSettingsDialog", "00", 0, QApplication::UnicodeUTF8) + << QApplication::translate("ProfileSettingsDialog", "011", 0, QApplication::UnicodeUTF8) + ); + labelDTMFPrefix->setText(QApplication::translate("ProfileSettingsDialog", "DTMF tone prefix: ", 0, QApplication::UnicodeUTF8)); + labelDTMFSuffix->setText(QApplication::translate("ProfileSettingsDialog", "DTMF tone suffix:", 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 index 0000000..e4cceb3 --- /dev/null +++ b/src/vicar-config/uis/ui_profileswindow.h @@ -0,0 +1,146 @@ +/******************************************************************************** +** Form generated from reading UI file 'profileswindow.ui' +** +** Created: Mon Jan 2 23:41:00 2012 +** by: Qt User Interface Compiler version 4.7.4 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef UI_PROFILESWINDOW_H +#define UI_PROFILESWINDOW_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +class Ui_ProfilesWindow +{ +public: + QAction *actionRoutingEnabled; + QAction *actionRouteOnDefault; + QAction *actionEditDefaultProfile; + QWidget *centralwidget; + QWidget *layoutWidget; + QVBoxLayout *verticalLayout; + QHBoxLayout *horizontalLayout; + QPushButton *addButton; + QPushButton *editButton; + 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); + actionEditDefaultProfile = new QAction(ProfilesWindow); + actionEditDefaultProfile->setObjectName(QString::fromUtf8("actionEditDefaultProfile")); + 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); + + editButton = new QPushButton(layoutWidget); + editButton->setObjectName(QString::fromUtf8("editButton")); + + horizontalLayout->addWidget(editButton); + + 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, 27)); + menuVicarProfiles = new QMenu(menubar); + menuVicarProfiles->setObjectName(QString::fromUtf8("menuVicarProfiles")); + ProfilesWindow->setMenuBar(menubar); + + menubar->addAction(menuVicarProfiles->menuAction()); + menuVicarProfiles->addAction(actionRoutingEnabled); + menuVicarProfiles->addAction(actionRouteOnDefault); + menuVicarProfiles->addAction(actionEditDefaultProfile); + + 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 + actionEditDefaultProfile->setText(QApplication::translate("ProfilesWindow", "Edit Default Profile", 0, QApplication::UnicodeUTF8)); +#ifndef QT_NO_TOOLTIP + actionEditDefaultProfile->setToolTip(QApplication::translate("ProfilesWindow", "Create/Edit profile to be used when no other profile is found for a number", 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 diff --git a/src/vicar-config/vicar-config.pro b/src/vicar-config/vicar-config.pro index 640b2a3..8d9af24 100755 --- a/src/vicar-config/vicar-config.pro +++ b/src/vicar-config/vicar-config.pro @@ -1,31 +1,28 @@ -INCLUDEPATH += . -INCLUDEPATH += /usr/include/gconf/2 \ - /usr/include/glib-2.0 \ - /usr/lib/glib-2.0/include -INCLUDEPATH += ../vicar-lib/src -LIBS += /usr/lib/libgconf-2.so +#INCLUDEPATH += . +INCLUDEPATH += ../vicar-lib/cpp + +CONFIG += link_pkgconfig +PKGCONFIG += glib-2.0 gconf-2.0 + LIBS += ../lib/libvicar.a -CONFIG += qt \ - debug +CONFIG += qt QT += dbus sql TEMPLATE = app TARGET = vicar-config -VPATH += src \ +VPATH += cpp \ uis UI_DIR = uis -MOC_DIR = mocs -OBJECTS_DIR = objs +MOC_DIR = cpp/.mocs +OBJECTS_DIR = cpp/.objs # Input -HEADERS += profileswindow.h \ - profilesettingsdialog.h -FORMS += profileswindow.ui \ - profilesettingsdialog.ui -SOURCES += main.cpp \ - profileswindow.cpp \ - profilesettingsdialog.cpp +HEADERS += cpp/profileswindow.h \ + cpp/profilesettingsdialog.h +FORMS += uis/profileswindow.ui \ + uis/profilesettingsdialog.ui +SOURCES += cpp/main.cpp \ + cpp/profileswindow.cpp \ + cpp/profilesettingsdialog.cpp -# MAKE INSTALL -INSTALLDIR = /../../debian/vicar INSTALLS += target -target.path = $$INSTALLDIR/opt/vicar +target.path = /opt/vicar/bin diff --git a/src/vicar-daemon/cpp/callrouter.cpp b/src/vicar-daemon/cpp/callrouter.cpp new file mode 100755 index 0000000..7a5d8ed --- /dev/null +++ b/src/vicar-daemon/cpp/callrouter.cpp @@ -0,0 +1,496 @@ +/* +@version: 0.6 +@author: Sudheer K. +@license: GNU General Public License +*/ + +#include "callrouter.h" +#include "vicardbusadaptor.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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; + QString strLastDTMFCode; + org::maemo::vicar::Profile *currentProfile; + CallRouter * const parent; +}; + +// --------------------------------------------------------------------------- + +CallRouter::CallRouter(QObject *parent) : + QObject(parent), + d(new CallRouterPrivate(this)) +{ + Q_ASSERT(0 != d); + this->registerDBusService(); + qDebug() << "Vicar-Daemon: Registered DBus Service " << APPLICATION_DBUS_SERVICE; +} + +CallRouter::~CallRouter(){ +} + +void CallRouter::registerDBusService(){ + //Connect to Session Bus + QDBusConnection connection = d->dbusUtility->getConnection(false); + + if (!connection.interface()->isServiceRegistered(APPLICATION_DBUS_SERVICE)){ + + if (!connection.registerService(APPLICATION_DBUS_SERVICE)) { + qDebug() << "Vicar-Daemon: " << d->dbusUtility->getErrorMessage(); + exit(1); + } + } + + if (!connection.registerObject(APPLICATION_DBUS_PATH, this, QDBusConnection::ExportAdaptors)) { + qDebug() << "Vicar-Daemon: " << d->dbusUtility->getErrorMessage(); + exit(2); + } + +} + + +void CallRouter::unregisterDBusService(){ + + //Disconnect from Session bus + QDBusConnection connection = d->dbusUtility->getConnection(false); + + connection.unregisterObject(APPLICATION_DBUS_PATH,QDBusConnection::UnregisterTree); + + if (!connection.unregisterService(APPLICATION_DBUS_SERVICE)) { + qDebug() << "Vicar-Daemon: " << d->dbusUtility->getErrorMessage(); + exit(3); + } + +} + +QString CallRouter::callViaCallingCard(QString strDestinationNumber){ + + d->currentProfile = new org::maemo::vicar::Profile(); + d->currentProfile->profileID = 0; + + d->databaseUtility->openDatabase(); + bool result = d->databaseUtility->findProfileByNumber(strDestinationNumber,d->currentProfile); + + QString strErrorMessage; + if (!result){ + strErrorMessage = QString("Vicar-Daemon: Error finding VICaR profile. %1").arg(d->databaseUtility->lastError().text()); + } + else if (d->currentProfile->profileID == 0){ + bool routeOnDefault = d->gconfUtility->getGconfValueBoolean("route_on_default"); + if (routeOnDefault){ + qDebug() << "Vicar-Daemon: Routing directly as per configuration"; + this->placeCall(strDestinationNumber); + } + else{ + qDebug() << "Vicar-Daemon: 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() << "Vicar-Daemon: Initiating call to "<< strCallingCardNumber; + bool status = this->placeCall(strCallingCardNumber); + d->strLastDialedNumber = strDestinationNumber; + + QString strUserMessage; + + if (status){ + qDebug() << "Vicar-Daemon: 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() << "Vicar-Daemon: " << strErrorMessage; + d->strLastDialedNumber.clear(); + delete d->currentProfile; + d->currentProfile = 0; + } + d->dbusUtility->displayNotification(strUserMessage); + } + + d->databaseUtility->closeDatabase(); + return strErrorMessage; +} + +bool CallRouter::placeCall(QString number){ + + QList argsToSend; + argsToSend.append(number); + argsToSend.append(0); + + bool status = d->dbusUtility->sendMethodCall(CSD_SERVICE, + CSD_CALL_PATH, + CSD_CALL_INTERFACE, + QString("CreateWith"),argsToSend); + return status; + +} + +void CallRouter::startCallStatusMonitors(){ + /* Declare the slot to be executed when a call is picked up by other party (Audio connection established). + We need this to confirm whether a call went though successfully. + */ + + QDBusConnection connection = d->dbusUtility->getConnection(); + + bool success = connection.connect(QString(""), + CSD_CALL_INSTANCE_PATH, + CSD_CALL_INSTANCE_INTERFACE, + QString("AudioConnect"),this, + SLOT(sendNumberAsDTMFCode(const QDBusMessage&))); + + if (success){ + qDebug() << "Vicar-Daemon: Successfully connected to Dbus signal AudioConnect in interface "<< CSD_CALL_INSTANCE_INTERFACE; + } + else{ + qDebug() << "Vicar-Daemon: Failed to connect to Dbus signal AudioConnect in interface "<< CSD_CALL_INSTANCE_INTERFACE; + qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage(); + } + + + /* Declare the slot to be executed when the DTMF code is sent. + */ + + success = connection.connect(QString(""), + CSD_CALL_INSTANCE_PATH, + CSD_CALL_INSTANCE_INTERFACE, + QString("StoppedDTMF"),this, + SLOT(displayDTMFConfirmation())); + + if (success){ + qDebug() << "Vicar-Daemon: Successfully connected to Dbus signal StoppedDTMF in interface "<< CSD_CALL_INSTANCE_INTERFACE; + } + else{ + qDebug() << "Vicar-Daemon: Failed to connect to Dbus signal StoppedDTMF in interface "<< CSD_CALL_INSTANCE_INTERFACE; + qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage(); + } + + + /* Declare the slot to be executed when the call is terminated (due to connection errors etc). + We need this to avoid sending DTMF code on wrong calls. + */ + + success = connection.connect(QString(""), + CSD_CALL_INSTANCE_PATH, + CSD_CALL_INSTANCE_INTERFACE, + QString("Terminated"),this, + SLOT(stopCallStatusMonitors())); + + if (success){ + qDebug() << "Vicar-Daemon: Successfully connected to Dbus signal Terminated in interface "<< CSD_CALL_INSTANCE_INTERFACE; + } + else{ + qDebug() << "Vicar-Daemon: Failed to connect to Dbus signal Terminated in interface "<< CSD_CALL_INSTANCE_INTERFACE; + qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage(); + } + + /* Declare the slot to be executed when a call is received + (before we can place the call to calling card number). + It is extremely rare that somebody should get a call within these few seconds. + In any case, we need this to avoid sending DTMF code on the received call. + + Btw - I don't care for the incoming number here. If anyone is calling the user before we can send DTMF code, + then we stop sending the DTMF code even if user does not respond to the call. + */ + + success = connection.connect(QString(""), + CSD_CALL_PATH, + CSD_CALL_INTERFACE, + QString("Coming"),this, + SLOT(stopCallStatusMonitors())); + + if (success){ + qDebug() << "Vicar-Daemon: Successfully connected to Dbus signal Coming in interface" << CSD_CALL_INTERFACE; + } + else{ + qDebug() << "Vicar-Daemon: Failed to connect to Dbus signal Coming in interface" << CSD_CALL_INTERFACE; + qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage(); + } +} + +void CallRouter::stopCallStatusMonitors(){ + + d->strLastDTMFCode.clear(); + d->strLastDialedNumber.clear(); + delete d->currentProfile; + d->currentProfile = 0; + + QDBusConnection connection = d->dbusUtility->getConnection(); + + // Disconnect the slot for audio connection status + bool status = connection.disconnect(QString(""), + CSD_CALL_INSTANCE_PATH, + CSD_CALL_INSTANCE_INTERFACE, + QString("AudioConnect"),this, + SLOT(sendNumberAsDTMFCode(const QDBusMessage&))); + + if (status){ + qDebug() << "Vicar-Daemon: Successfully disconnected from Dbus signal AudioConnect in interface "<< CSD_CALL_INSTANCE_INTERFACE; + } + else{ + qDebug() << "Vicar-Daemon: Failed to disconnect from Dbus signal AudioConnect in interface "<< CSD_CALL_INSTANCE_INTERFACE; + qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage(); + } + + // Disconnect the slot for monitoring DTMF completion + status = connection.disconnect(QString(""), + CSD_CALL_INSTANCE_PATH, + CSD_CALL_INSTANCE_INTERFACE, + QString("StoppedDTMF"),this, + SLOT(displayDTMFConfirmation())); + + if (status){ + qDebug() << "Vicar-Daemon: Successfully disconnected from Dbus signal StoppedDTMF in interface "<< CSD_CALL_INSTANCE_INTERFACE; + } + else{ + qDebug() << "Vicar-Daemon: Failed to disconnect from Dbus signal StoppedDTMF in interface "<< CSD_CALL_INSTANCE_INTERFACE; + qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage(); + } + + + // Disconnect the slot for monitoring terminated calls + status = connection.disconnect(QString(""), + CSD_CALL_INSTANCE_PATH, + CSD_CALL_INSTANCE_INTERFACE, + QString("Terminated"),this, + SLOT(stopCallStatusMonitors())); + + if (status){ + qDebug() << "Vicar-Daemon: Successfully disconnected from Dbus signal Terminated in interface "<< CSD_CALL_INSTANCE_INTERFACE; + } + else{ + qDebug() << "Vicar-Daemon: Failed to disconnect from Dbus signal Terminated in interface "<< CSD_CALL_INSTANCE_INTERFACE; + qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage(); + } + + // Disconnect the slot for monitoring incoming calls + status = connection.disconnect(QString(""), + CSD_CALL_PATH, + CSD_CALL_INTERFACE, + QString("Coming"),this, + SLOT(stopCallStatusMonitors())); + + if (status){ + qDebug() << "Vicar-Daemon: Successfully disconnected from Dbus signal Coming in interface" << CSD_CALL_INTERFACE; + } + else{ + qDebug() << "Vicar-Daemon: Failed to disconnect from Dbus signal Coming in interface" << CSD_CALL_INTERFACE; + qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage(); + } +} + +void CallRouter::sendNumberAsDTMFCode(const QDBusMessage& dbusMessage){ + + if (!d->strLastDialedNumber.isEmpty() && d->currentProfile != 0){ + //Verify whether we have the last dialed number available + + QList listArguments = dbusMessage.arguments(); + bool audioConnected = listArguments.first().toBool(); + + if (audioConnected){ + // Now that the call to Calling card number is successful. We can send the original number as DTMF tones + QString strDTMFCode = convertToDTMFCode(d->strLastDialedNumber); + + qDebug() << "Vicar-Daemon: Audio connection established. Sending DTMF code "<< strDTMFCode; + + + QList argsToSend; + argsToSend.append(strDTMFCode); + bool status = d->dbusUtility->sendMethodCall(CSD_SERVICE, + CSD_CALL_PATH, + CSD_CALL_INTERFACE, + QString("SendDTMF"),argsToSend); + + if (status){ + qDebug() << "Vicar-Daemon: Sending " << strDTMFCode << " as DTMF code."; + d->strLastDTMFCode = strDTMFCode; + } + else{ + qDebug() << "Vicar-Daemon: Unable to send DTMF code."; + } + } + else{ + qDebug() << "Vicar-Daemon: Audio not yet connected."; + } + } + else + { + qDebug() << "Vicar-Daemon: Last dialed number is empty."; + } +} + +void CallRouter::displayDTMFConfirmation(){ + //This slot is called when the all the DTMF tones are sent (i.e StoppedDTMF signal is emitted) + //Just display confirmation message and cleanup + + + if (!d->strLastDTMFCode.isEmpty()){ + QString strMessage = d->strLastDTMFCode.append(" sent as DTMF code"); + d->dbusUtility->displayNotification(strMessage); + qDebug() << "Vicar-Daemon: "<< d->strLastDTMFCode << " sent as DTMF code."; + } + + /* + Connecting and Disconnecting from/to DBus signal for each international call + may not be the most efficient way of handling this. But we need to make sure + that the DTMF codes are sent only for the calls placed by this app (i.e calls to Calling card number). + */ + + qDebug() << "Vicar-Daemon: Now disconnecting from call status monitors.."; + stopCallStatusMonitors(); +} + +QString CallRouter::convertToDTMFCode(QString strNumber){ + QString strDTMFCode; + + if (!strNumber.isEmpty()){ + //int intDTMFDelay = 1; + + //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); + strDTMFCode = ""; + + //Now check whether we need a prefix + QString strDTMFPrefix = d->currentProfile->dtmfPrefix; + + 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 = ""; + + /* Replace 00 (international dialing code) at the beginning + and also replace any character other than the numbers 0-9 and p. + */ + QRegExp regexp = QRegExp("(^0{2})|[^0-9p]"); + strNumber = strNumber.replace(regexp,""); + + /* Now we have a clean number with only country code, area code and phone number, + lets convert it to the calling card friendly format + */ + if (qstrDTMFFormat.startsWith("+")){ + strDTMFCode = strDTMFCode.append("+"); + } + else if (qstrDTMFFormat.startsWith("00")){ + strDTMFCode = strDTMFCode.append("00"); + } + else if (qstrDTMFFormat.startsWith("011")){ + strDTMFCode = strDTMFCode.append("011"); + } + + strDTMFCode = strDTMFCode.append(strNumber); + + //Now check whether we need a suffix + QString strDTMFSuffix = d->currentProfile->dtmfSuffix; + if (!strDTMFSuffix.isEmpty()){ + strDTMFCode = strDTMFCode.append(strDTMFSuffix); + } + } + + return strDTMFCode; +} + +//DBus Method used by external applications to check whether VICaR is enabled and running +bool CallRouter::isRunning(){ + + return true; + + //Verify Whether VICaR telepathy account is online + /* + if (d->tpUtility->getAccountStatus() == "Connected"){ + return true; + } + else{ + return false; + } + */ +} + +//DBus Method used by external applications to call via VICaR +QString CallRouter::callInternationalNumber(const QString& strDestinationNumber){ + + QString strErrorMessage; + + qDebug() << "Vicar-Daemon: New call requested by external application. Destination number is " << strDestinationNumber; + + if (isValidPhoneNumber(strDestinationNumber)){ + + //Remove spaces in the phone number before using + QString numberWithoutSpaces = QString(strDestinationNumber).remove(" "); + + strErrorMessage = this->callViaCallingCard(numberWithoutSpaces); + } + else{ + strErrorMessage = QString("Vicar-Daemon: %1 is not a valid number").arg(strDestinationNumber); + if (strDestinationNumber != "publish" && strDestinationNumber != "subscribe"){ + d->dbusUtility->displayNotification(QString("Vicar: %1 is not a valid number").arg(strDestinationNumber)); + } + } + + qDebug() << strErrorMessage; + + if (strErrorMessage.isEmpty()){ + return QString("Success"); + } + else{ + return strErrorMessage; + } + } + +//Check whether a string is valid phone number +bool CallRouter::isValidPhoneNumber(QString strPhoneNumber){ + +/* Remove all dialble characters and space. The resulting string should be a valid number */ + QRegExp regexp = QRegExp("[p+*# ]"); + + strPhoneNumber = strPhoneNumber.replace(regexp,""); + + qDebug() << "Vicar Daemon: Cleaned up phone number is " << strPhoneNumber; + +/* Now remove all digits, the resulting string should be empty, then it is a valid number */ + regexp = QRegExp("[0-9]"); + + strPhoneNumber = strPhoneNumber.replace(regexp,""); + + bool isNumber = strPhoneNumber.isEmpty(); + return isNumber; +} diff --git a/src/vicar-daemon/cpp/callrouter.h b/src/vicar-daemon/cpp/callrouter.h new file mode 100755 index 0000000..65288b1 --- /dev/null +++ b/src/vicar-daemon/cpp/callrouter.h @@ -0,0 +1,66 @@ +/* +@version: 0.6 +@author: Sudheer K. +@license: GNU General Public License +*/ + +#ifndef CALLROUTER_H +#define CALLROUTER_H + +#include +#include +#include +#include +#include "vicardbusadaptor.h" + +#define APPLICATION_DBUS_PATH "/org/maemo/vicar" +#define APPLICATION_DBUS_INTERFACE "org.maemo.vicar" +#define APPLICATION_DBUS_SERVICE "org.maemo.vicar" +#define APPLICATION_FRIENDLY_NAME "VICaR" + +/* CSD CALL plugin D-Bus definitions */ +#define CSD_CALL_BUS_NAME "com.nokia.csd.Call" +#define CSD_CALL_INTERFACE "com.nokia.csd.Call" +#define CSD_CALL_INSTANCE_INTERFACE "com.nokia.csd.Call.Instance" +#define CSD_CALL_CONFERENCE "com.nokia.csd.Call.Conference" +#define CSD_CALL_PATH "/com/nokia/csd/call" +#define CSD_CALL_INSTANCE_PATH "/com/nokia/csd/call/1" +#define CSD_CALL_SERVICE "com.nokia.csd.Call" +#define CSD_SERVICE "com.nokia.csd" + +class CallRouterPrivate; + +class CallRouter : public QObject +{ +Q_OBJECT +Q_CLASSINFO("D-Bus Interface", "org.maemo.vicar") + +public: + CallRouter(QObject *parent = 0); + ~CallRouter(); + void registerDBusService(); + void unregisterDBusService(); + bool isValidPhoneNumber(QString); + +protected: + void startCallStatusMonitors(); + QString convertToDTMFCode(QString); + bool isExcludedNumber(QString); + bool placeCall(QString); + +protected slots: + QString callViaCallingCard(QString); + void sendNumberAsDTMFCode(const QDBusMessage& dbusMessage); + void displayDTMFConfirmation(); + void stopCallStatusMonitors(); + + //D-Bus Interface Methods +public slots: + bool isRunning(); + QString callInternationalNumber(const QString& internationalNumber); + +private: + CallRouterPrivate * const d; +}; + +#endif // CALLROUTER_H diff --git a/src/vicar-daemon/cpp/main.cpp b/src/vicar-daemon/cpp/main.cpp new file mode 100755 index 0000000..2bc7754 --- /dev/null +++ b/src/vicar-daemon/cpp/main.cpp @@ -0,0 +1,21 @@ +/* +@version: 0.6 +@author: Sudheer K. +@license: GNU General Public License +*/ + +#include +#include +#include +#include "callrouter.h" +//#include "vicarprofiletypes.h" + +int main(int argc, char *argv[]) +{ + //qDBusRegisterMetaType(); + //qDBusRegisterMetaType(); + + QCoreApplication a(argc, argv); + CallRouter callRouter(&a); + return a.exec(); +} diff --git a/src/vicar-daemon/cpp/vicardbusadaptor.cpp b/src/vicar-daemon/cpp/vicardbusadaptor.cpp new file mode 100755 index 0000000..5f387ca --- /dev/null +++ b/src/vicar-daemon/cpp/vicardbusadaptor.cpp @@ -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 +#include +#include +#include +#include +#include +#include + +/* + * 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/cpp/vicardbusadaptor.h b/src/vicar-daemon/cpp/vicardbusadaptor.h new file mode 100755 index 0000000..85256f2 --- /dev/null +++ b/src/vicar-daemon/cpp/vicardbusadaptor.h @@ -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 +#include +class QByteArray; +template class QList; +template 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", "" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \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 diff --git a/src/vicar-daemon/src/callrouter.cpp b/src/vicar-daemon/src/callrouter.cpp deleted file mode 100755 index 7a5d8ed..0000000 --- a/src/vicar-daemon/src/callrouter.cpp +++ /dev/null @@ -1,496 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@license: GNU General Public License -*/ - -#include "callrouter.h" -#include "vicardbusadaptor.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -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; - QString strLastDTMFCode; - org::maemo::vicar::Profile *currentProfile; - CallRouter * const parent; -}; - -// --------------------------------------------------------------------------- - -CallRouter::CallRouter(QObject *parent) : - QObject(parent), - d(new CallRouterPrivate(this)) -{ - Q_ASSERT(0 != d); - this->registerDBusService(); - qDebug() << "Vicar-Daemon: Registered DBus Service " << APPLICATION_DBUS_SERVICE; -} - -CallRouter::~CallRouter(){ -} - -void CallRouter::registerDBusService(){ - //Connect to Session Bus - QDBusConnection connection = d->dbusUtility->getConnection(false); - - if (!connection.interface()->isServiceRegistered(APPLICATION_DBUS_SERVICE)){ - - if (!connection.registerService(APPLICATION_DBUS_SERVICE)) { - qDebug() << "Vicar-Daemon: " << d->dbusUtility->getErrorMessage(); - exit(1); - } - } - - if (!connection.registerObject(APPLICATION_DBUS_PATH, this, QDBusConnection::ExportAdaptors)) { - qDebug() << "Vicar-Daemon: " << d->dbusUtility->getErrorMessage(); - exit(2); - } - -} - - -void CallRouter::unregisterDBusService(){ - - //Disconnect from Session bus - QDBusConnection connection = d->dbusUtility->getConnection(false); - - connection.unregisterObject(APPLICATION_DBUS_PATH,QDBusConnection::UnregisterTree); - - if (!connection.unregisterService(APPLICATION_DBUS_SERVICE)) { - qDebug() << "Vicar-Daemon: " << d->dbusUtility->getErrorMessage(); - exit(3); - } - -} - -QString CallRouter::callViaCallingCard(QString strDestinationNumber){ - - d->currentProfile = new org::maemo::vicar::Profile(); - d->currentProfile->profileID = 0; - - d->databaseUtility->openDatabase(); - bool result = d->databaseUtility->findProfileByNumber(strDestinationNumber,d->currentProfile); - - QString strErrorMessage; - if (!result){ - strErrorMessage = QString("Vicar-Daemon: Error finding VICaR profile. %1").arg(d->databaseUtility->lastError().text()); - } - else if (d->currentProfile->profileID == 0){ - bool routeOnDefault = d->gconfUtility->getGconfValueBoolean("route_on_default"); - if (routeOnDefault){ - qDebug() << "Vicar-Daemon: Routing directly as per configuration"; - this->placeCall(strDestinationNumber); - } - else{ - qDebug() << "Vicar-Daemon: 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() << "Vicar-Daemon: Initiating call to "<< strCallingCardNumber; - bool status = this->placeCall(strCallingCardNumber); - d->strLastDialedNumber = strDestinationNumber; - - QString strUserMessage; - - if (status){ - qDebug() << "Vicar-Daemon: 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() << "Vicar-Daemon: " << strErrorMessage; - d->strLastDialedNumber.clear(); - delete d->currentProfile; - d->currentProfile = 0; - } - d->dbusUtility->displayNotification(strUserMessage); - } - - d->databaseUtility->closeDatabase(); - return strErrorMessage; -} - -bool CallRouter::placeCall(QString number){ - - QList argsToSend; - argsToSend.append(number); - argsToSend.append(0); - - bool status = d->dbusUtility->sendMethodCall(CSD_SERVICE, - CSD_CALL_PATH, - CSD_CALL_INTERFACE, - QString("CreateWith"),argsToSend); - return status; - -} - -void CallRouter::startCallStatusMonitors(){ - /* Declare the slot to be executed when a call is picked up by other party (Audio connection established). - We need this to confirm whether a call went though successfully. - */ - - QDBusConnection connection = d->dbusUtility->getConnection(); - - bool success = connection.connect(QString(""), - CSD_CALL_INSTANCE_PATH, - CSD_CALL_INSTANCE_INTERFACE, - QString("AudioConnect"),this, - SLOT(sendNumberAsDTMFCode(const QDBusMessage&))); - - if (success){ - qDebug() << "Vicar-Daemon: Successfully connected to Dbus signal AudioConnect in interface "<< CSD_CALL_INSTANCE_INTERFACE; - } - else{ - qDebug() << "Vicar-Daemon: Failed to connect to Dbus signal AudioConnect in interface "<< CSD_CALL_INSTANCE_INTERFACE; - qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage(); - } - - - /* Declare the slot to be executed when the DTMF code is sent. - */ - - success = connection.connect(QString(""), - CSD_CALL_INSTANCE_PATH, - CSD_CALL_INSTANCE_INTERFACE, - QString("StoppedDTMF"),this, - SLOT(displayDTMFConfirmation())); - - if (success){ - qDebug() << "Vicar-Daemon: Successfully connected to Dbus signal StoppedDTMF in interface "<< CSD_CALL_INSTANCE_INTERFACE; - } - else{ - qDebug() << "Vicar-Daemon: Failed to connect to Dbus signal StoppedDTMF in interface "<< CSD_CALL_INSTANCE_INTERFACE; - qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage(); - } - - - /* Declare the slot to be executed when the call is terminated (due to connection errors etc). - We need this to avoid sending DTMF code on wrong calls. - */ - - success = connection.connect(QString(""), - CSD_CALL_INSTANCE_PATH, - CSD_CALL_INSTANCE_INTERFACE, - QString("Terminated"),this, - SLOT(stopCallStatusMonitors())); - - if (success){ - qDebug() << "Vicar-Daemon: Successfully connected to Dbus signal Terminated in interface "<< CSD_CALL_INSTANCE_INTERFACE; - } - else{ - qDebug() << "Vicar-Daemon: Failed to connect to Dbus signal Terminated in interface "<< CSD_CALL_INSTANCE_INTERFACE; - qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage(); - } - - /* Declare the slot to be executed when a call is received - (before we can place the call to calling card number). - It is extremely rare that somebody should get a call within these few seconds. - In any case, we need this to avoid sending DTMF code on the received call. - - Btw - I don't care for the incoming number here. If anyone is calling the user before we can send DTMF code, - then we stop sending the DTMF code even if user does not respond to the call. - */ - - success = connection.connect(QString(""), - CSD_CALL_PATH, - CSD_CALL_INTERFACE, - QString("Coming"),this, - SLOT(stopCallStatusMonitors())); - - if (success){ - qDebug() << "Vicar-Daemon: Successfully connected to Dbus signal Coming in interface" << CSD_CALL_INTERFACE; - } - else{ - qDebug() << "Vicar-Daemon: Failed to connect to Dbus signal Coming in interface" << CSD_CALL_INTERFACE; - qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage(); - } -} - -void CallRouter::stopCallStatusMonitors(){ - - d->strLastDTMFCode.clear(); - d->strLastDialedNumber.clear(); - delete d->currentProfile; - d->currentProfile = 0; - - QDBusConnection connection = d->dbusUtility->getConnection(); - - // Disconnect the slot for audio connection status - bool status = connection.disconnect(QString(""), - CSD_CALL_INSTANCE_PATH, - CSD_CALL_INSTANCE_INTERFACE, - QString("AudioConnect"),this, - SLOT(sendNumberAsDTMFCode(const QDBusMessage&))); - - if (status){ - qDebug() << "Vicar-Daemon: Successfully disconnected from Dbus signal AudioConnect in interface "<< CSD_CALL_INSTANCE_INTERFACE; - } - else{ - qDebug() << "Vicar-Daemon: Failed to disconnect from Dbus signal AudioConnect in interface "<< CSD_CALL_INSTANCE_INTERFACE; - qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage(); - } - - // Disconnect the slot for monitoring DTMF completion - status = connection.disconnect(QString(""), - CSD_CALL_INSTANCE_PATH, - CSD_CALL_INSTANCE_INTERFACE, - QString("StoppedDTMF"),this, - SLOT(displayDTMFConfirmation())); - - if (status){ - qDebug() << "Vicar-Daemon: Successfully disconnected from Dbus signal StoppedDTMF in interface "<< CSD_CALL_INSTANCE_INTERFACE; - } - else{ - qDebug() << "Vicar-Daemon: Failed to disconnect from Dbus signal StoppedDTMF in interface "<< CSD_CALL_INSTANCE_INTERFACE; - qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage(); - } - - - // Disconnect the slot for monitoring terminated calls - status = connection.disconnect(QString(""), - CSD_CALL_INSTANCE_PATH, - CSD_CALL_INSTANCE_INTERFACE, - QString("Terminated"),this, - SLOT(stopCallStatusMonitors())); - - if (status){ - qDebug() << "Vicar-Daemon: Successfully disconnected from Dbus signal Terminated in interface "<< CSD_CALL_INSTANCE_INTERFACE; - } - else{ - qDebug() << "Vicar-Daemon: Failed to disconnect from Dbus signal Terminated in interface "<< CSD_CALL_INSTANCE_INTERFACE; - qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage(); - } - - // Disconnect the slot for monitoring incoming calls - status = connection.disconnect(QString(""), - CSD_CALL_PATH, - CSD_CALL_INTERFACE, - QString("Coming"),this, - SLOT(stopCallStatusMonitors())); - - if (status){ - qDebug() << "Vicar-Daemon: Successfully disconnected from Dbus signal Coming in interface" << CSD_CALL_INTERFACE; - } - else{ - qDebug() << "Vicar-Daemon: Failed to disconnect from Dbus signal Coming in interface" << CSD_CALL_INTERFACE; - qDebug() <<"Vicar-Daemon: DBus Error: "<< d->dbusUtility->getErrorMessage(); - } -} - -void CallRouter::sendNumberAsDTMFCode(const QDBusMessage& dbusMessage){ - - if (!d->strLastDialedNumber.isEmpty() && d->currentProfile != 0){ - //Verify whether we have the last dialed number available - - QList listArguments = dbusMessage.arguments(); - bool audioConnected = listArguments.first().toBool(); - - if (audioConnected){ - // Now that the call to Calling card number is successful. We can send the original number as DTMF tones - QString strDTMFCode = convertToDTMFCode(d->strLastDialedNumber); - - qDebug() << "Vicar-Daemon: Audio connection established. Sending DTMF code "<< strDTMFCode; - - - QList argsToSend; - argsToSend.append(strDTMFCode); - bool status = d->dbusUtility->sendMethodCall(CSD_SERVICE, - CSD_CALL_PATH, - CSD_CALL_INTERFACE, - QString("SendDTMF"),argsToSend); - - if (status){ - qDebug() << "Vicar-Daemon: Sending " << strDTMFCode << " as DTMF code."; - d->strLastDTMFCode = strDTMFCode; - } - else{ - qDebug() << "Vicar-Daemon: Unable to send DTMF code."; - } - } - else{ - qDebug() << "Vicar-Daemon: Audio not yet connected."; - } - } - else - { - qDebug() << "Vicar-Daemon: Last dialed number is empty."; - } -} - -void CallRouter::displayDTMFConfirmation(){ - //This slot is called when the all the DTMF tones are sent (i.e StoppedDTMF signal is emitted) - //Just display confirmation message and cleanup - - - if (!d->strLastDTMFCode.isEmpty()){ - QString strMessage = d->strLastDTMFCode.append(" sent as DTMF code"); - d->dbusUtility->displayNotification(strMessage); - qDebug() << "Vicar-Daemon: "<< d->strLastDTMFCode << " sent as DTMF code."; - } - - /* - Connecting and Disconnecting from/to DBus signal for each international call - may not be the most efficient way of handling this. But we need to make sure - that the DTMF codes are sent only for the calls placed by this app (i.e calls to Calling card number). - */ - - qDebug() << "Vicar-Daemon: Now disconnecting from call status monitors.."; - stopCallStatusMonitors(); -} - -QString CallRouter::convertToDTMFCode(QString strNumber){ - QString strDTMFCode; - - if (!strNumber.isEmpty()){ - //int intDTMFDelay = 1; - - //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); - strDTMFCode = ""; - - //Now check whether we need a prefix - QString strDTMFPrefix = d->currentProfile->dtmfPrefix; - - 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 = ""; - - /* Replace 00 (international dialing code) at the beginning - and also replace any character other than the numbers 0-9 and p. - */ - QRegExp regexp = QRegExp("(^0{2})|[^0-9p]"); - strNumber = strNumber.replace(regexp,""); - - /* Now we have a clean number with only country code, area code and phone number, - lets convert it to the calling card friendly format - */ - if (qstrDTMFFormat.startsWith("+")){ - strDTMFCode = strDTMFCode.append("+"); - } - else if (qstrDTMFFormat.startsWith("00")){ - strDTMFCode = strDTMFCode.append("00"); - } - else if (qstrDTMFFormat.startsWith("011")){ - strDTMFCode = strDTMFCode.append("011"); - } - - strDTMFCode = strDTMFCode.append(strNumber); - - //Now check whether we need a suffix - QString strDTMFSuffix = d->currentProfile->dtmfSuffix; - if (!strDTMFSuffix.isEmpty()){ - strDTMFCode = strDTMFCode.append(strDTMFSuffix); - } - } - - return strDTMFCode; -} - -//DBus Method used by external applications to check whether VICaR is enabled and running -bool CallRouter::isRunning(){ - - return true; - - //Verify Whether VICaR telepathy account is online - /* - if (d->tpUtility->getAccountStatus() == "Connected"){ - return true; - } - else{ - return false; - } - */ -} - -//DBus Method used by external applications to call via VICaR -QString CallRouter::callInternationalNumber(const QString& strDestinationNumber){ - - QString strErrorMessage; - - qDebug() << "Vicar-Daemon: New call requested by external application. Destination number is " << strDestinationNumber; - - if (isValidPhoneNumber(strDestinationNumber)){ - - //Remove spaces in the phone number before using - QString numberWithoutSpaces = QString(strDestinationNumber).remove(" "); - - strErrorMessage = this->callViaCallingCard(numberWithoutSpaces); - } - else{ - strErrorMessage = QString("Vicar-Daemon: %1 is not a valid number").arg(strDestinationNumber); - if (strDestinationNumber != "publish" && strDestinationNumber != "subscribe"){ - d->dbusUtility->displayNotification(QString("Vicar: %1 is not a valid number").arg(strDestinationNumber)); - } - } - - qDebug() << strErrorMessage; - - if (strErrorMessage.isEmpty()){ - return QString("Success"); - } - else{ - return strErrorMessage; - } - } - -//Check whether a string is valid phone number -bool CallRouter::isValidPhoneNumber(QString strPhoneNumber){ - -/* Remove all dialble characters and space. The resulting string should be a valid number */ - QRegExp regexp = QRegExp("[p+*# ]"); - - strPhoneNumber = strPhoneNumber.replace(regexp,""); - - qDebug() << "Vicar Daemon: Cleaned up phone number is " << strPhoneNumber; - -/* Now remove all digits, the resulting string should be empty, then it is a valid number */ - regexp = QRegExp("[0-9]"); - - strPhoneNumber = strPhoneNumber.replace(regexp,""); - - bool isNumber = strPhoneNumber.isEmpty(); - return isNumber; -} diff --git a/src/vicar-daemon/src/callrouter.h b/src/vicar-daemon/src/callrouter.h deleted file mode 100755 index 65288b1..0000000 --- a/src/vicar-daemon/src/callrouter.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@license: GNU General Public License -*/ - -#ifndef CALLROUTER_H -#define CALLROUTER_H - -#include -#include -#include -#include -#include "vicardbusadaptor.h" - -#define APPLICATION_DBUS_PATH "/org/maemo/vicar" -#define APPLICATION_DBUS_INTERFACE "org.maemo.vicar" -#define APPLICATION_DBUS_SERVICE "org.maemo.vicar" -#define APPLICATION_FRIENDLY_NAME "VICaR" - -/* CSD CALL plugin D-Bus definitions */ -#define CSD_CALL_BUS_NAME "com.nokia.csd.Call" -#define CSD_CALL_INTERFACE "com.nokia.csd.Call" -#define CSD_CALL_INSTANCE_INTERFACE "com.nokia.csd.Call.Instance" -#define CSD_CALL_CONFERENCE "com.nokia.csd.Call.Conference" -#define CSD_CALL_PATH "/com/nokia/csd/call" -#define CSD_CALL_INSTANCE_PATH "/com/nokia/csd/call/1" -#define CSD_CALL_SERVICE "com.nokia.csd.Call" -#define CSD_SERVICE "com.nokia.csd" - -class CallRouterPrivate; - -class CallRouter : public QObject -{ -Q_OBJECT -Q_CLASSINFO("D-Bus Interface", "org.maemo.vicar") - -public: - CallRouter(QObject *parent = 0); - ~CallRouter(); - void registerDBusService(); - void unregisterDBusService(); - bool isValidPhoneNumber(QString); - -protected: - void startCallStatusMonitors(); - QString convertToDTMFCode(QString); - bool isExcludedNumber(QString); - bool placeCall(QString); - -protected slots: - QString callViaCallingCard(QString); - void sendNumberAsDTMFCode(const QDBusMessage& dbusMessage); - void displayDTMFConfirmation(); - void stopCallStatusMonitors(); - - //D-Bus Interface Methods -public slots: - bool isRunning(); - QString callInternationalNumber(const QString& internationalNumber); - -private: - CallRouterPrivate * const d; -}; - -#endif // CALLROUTER_H diff --git a/src/vicar-daemon/src/main.cpp b/src/vicar-daemon/src/main.cpp deleted file mode 100755 index 2bc7754..0000000 --- a/src/vicar-daemon/src/main.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@license: GNU General Public License -*/ - -#include -#include -#include -#include "callrouter.h" -//#include "vicarprofiletypes.h" - -int main(int argc, char *argv[]) -{ - //qDBusRegisterMetaType(); - //qDBusRegisterMetaType(); - - QCoreApplication a(argc, argv); - CallRouter callRouter(&a); - return a.exec(); -} diff --git a/src/vicar-daemon/src/vicardbusadaptor.cpp b/src/vicar-daemon/src/vicardbusadaptor.cpp deleted file mode 100755 index 5f387ca..0000000 --- a/src/vicar-daemon/src/vicardbusadaptor.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 -#include -#include -#include -#include -#include -#include - -/* - * 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 deleted file mode 100755 index 85256f2..0000000 --- a/src/vicar-daemon/src/vicardbusadaptor.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 -#include -class QByteArray; -template class QList; -template 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", "" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \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 diff --git a/src/vicar-daemon/vicar-daemon.pro b/src/vicar-daemon/vicar-daemon.pro index 0984e63..4f89a0a 100755 --- a/src/vicar-daemon/vicar-daemon.pro +++ b/src/vicar-daemon/vicar-daemon.pro @@ -1,9 +1,12 @@ -INCLUDEPATH += /usr/include/gconf/2 \ - /usr/include/glib-2.0 \ - /usr/lib/glib-2.0/include -INCLUDEPATH += ../vicar-lib/src +contains(MEEGO_EDITION,harmattan){ + DEFINES += Q_WS_MAEMO_6 +} + +INCLUDEPATH += ../vicar-lib/cpp + +CONFIG += link_pkgconfig +PKGCONFIG += glib-2.0 gconf-2.0 -LIBS += /usr/lib/libgconf-2.so LIBS += ../lib/libvicar.a CONFIG += qt debug @@ -14,20 +17,16 @@ TARGET = vicar-daemon CONFIG += console CONFIG -= app_bundle -VPATH += src -MOC_DIR = mocs -OBJECTS_DIR = objs +VPATH += cpp +MOC_DIR = cpp/.mocs +OBJECTS_DIR = cpp/.objs -SOURCES += src/main.cpp \ - src/callrouter.cpp \ - src/vicardbusadaptor.cpp -HEADERS += src/callrouter.h \ - src/vicardbusadaptor.h - -#MAKE INSTALL -INSTALLDIR = /../../debian/vicar +SOURCES += cpp/main.cpp \ + cpp/callrouter.cpp \ + cpp/vicardbusadaptor.cpp +HEADERS += cpp/callrouter.h \ + cpp/vicardbusadaptor.h INSTALLS += target - -target.path =$$INSTALLDIR/opt/vicar +target.path =/opt/vicar/bin diff --git a/src/vicar-lib/cpp/accountcompatproxy.cpp b/src/vicar-lib/cpp/accountcompatproxy.cpp new file mode 100644 index 0000000..97ffd81 --- /dev/null +++ b/src/vicar-lib/cpp/accountcompatproxy.cpp @@ -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/cpp/accountcompatproxy.h b/src/vicar-lib/cpp/accountcompatproxy.h new file mode 100644 index 0000000..024eba6 --- /dev/null +++ b/src/vicar-lib/cpp/accountcompatproxy.h @@ -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 +#include +#include +#include +#include +#include +#include +#include + +/* + * 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 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/cpp/accountmanagerproxy.cpp b/src/vicar-lib/cpp/accountmanagerproxy.cpp new file mode 100644 index 0000000..bdb9ac2 --- /dev/null +++ b/src/vicar-lib/cpp/accountmanagerproxy.cpp @@ -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/cpp/accountmanagerproxy.h b/src/vicar-lib/cpp/accountmanagerproxy.h new file mode 100644 index 0000000..10a97b9 --- /dev/null +++ b/src/vicar-lib/cpp/accountmanagerproxy.h @@ -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 +#include +#include +#include +#include +#include +#include +#include + +/* + * 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 CreateAccount(const QString &Connection_Manager, const QString &Protocol, const QString &Display_Name, const QVariantMap &Parameters, const QVariantMap &Properties) + { + QList 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/cpp/accountproxy.cpp b/src/vicar-lib/cpp/accountproxy.cpp new file mode 100644 index 0000000..d6a4934 --- /dev/null +++ b/src/vicar-lib/cpp/accountproxy.cpp @@ -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/cpp/accountproxy.h b/src/vicar-lib/cpp/accountproxy.h new file mode 100644 index 0000000..0f97df2 --- /dev/null +++ b/src/vicar-lib/cpp/accountproxy.h @@ -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 +#include +#include +#include +#include +#include +#include +#include + +/* + * 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 argumentList; + return asyncCallWithArgumentList(QLatin1String("Reconnect"), argumentList); + } + + inline QDBusPendingReply<> Remove() + { + QList argumentList; + return asyncCallWithArgumentList(QLatin1String("Remove"), argumentList); + } + + inline QDBusPendingReply UpdateParameters(const QVariantMap &Set, const QStringList &Unset) + { + QList 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/cpp/connectioninterfacerequeststypes.cpp b/src/vicar-lib/cpp/connectioninterfacerequeststypes.cpp new file mode 100644 index 0000000..d0546a5 --- /dev/null +++ b/src/vicar-lib/cpp/connectioninterfacerequeststypes.cpp @@ -0,0 +1,75 @@ +/* +@version: 0.6 +@author: Sudheer K. +@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 + * + * 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-lib/cpp/connectioninterfacerequeststypes.h b/src/vicar-lib/cpp/connectioninterfacerequeststypes.h new file mode 100644 index 0000000..8f1fab9 --- /dev/null +++ b/src/vicar-lib/cpp/connectioninterfacerequeststypes.h @@ -0,0 +1,78 @@ +/* +@version: 0.6 +@author: Sudheer K. +@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 + * Copyright (C) 2006 by INdT + * @author Andre Moreira Magalhaes + * + * 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 +#include +#include +#include +#include + +namespace org { +namespace freedesktop { +namespace Telepathy { + +class ChannelDetails +{ +public: + QDBusObjectPath channel; + QVariantMap properties; +}; +typedef QList ChannelDetailsList; + +class RequestableChannelClass +{ +public: + QVariantMap fixedProperties; + QStringList allowedProperties; +}; +typedef QList 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-lib/cpp/connifacereqproxy.cpp b/src/vicar-lib/cpp/connifacereqproxy.cpp new file mode 100644 index 0000000..abef41c --- /dev/null +++ b/src/vicar-lib/cpp/connifacereqproxy.cpp @@ -0,0 +1,26 @@ +/* + * This file was generated by qdbusxml2cpp version 0.7 + * Command line was: qdbusxml2cpp -c ConnectionInterfaceRequestsProxy -p connifacereqproxy.h:connifacereqproxy.cpp org.freedesktop.Telepathy.Connection.I.Requests.xml org.freedesktop.Telepathy.Connection.Interface.Requests + * + * 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 "connifacereqproxy.h" + +/* + * Implementation of interface class ConnectionInterfaceRequestsProxy + */ + +ConnectionInterfaceRequestsProxy::ConnectionInterfaceRequestsProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) + : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) +{ +} + +ConnectionInterfaceRequestsProxy::~ConnectionInterfaceRequestsProxy() +{ +} + diff --git a/src/vicar-lib/cpp/connifacereqproxy.h b/src/vicar-lib/cpp/connifacereqproxy.h new file mode 100644 index 0000000..c53359a --- /dev/null +++ b/src/vicar-lib/cpp/connifacereqproxy.h @@ -0,0 +1,95 @@ +/* + * This file was generated by qdbusxml2cpp version 0.7 + * Command line was: qdbusxml2cpp -c ConnectionInterfaceRequestsProxy -p connifacereqproxy.h:connifacereqproxy.cpp org.freedesktop.Telepathy.Connection.I.Requests.xml org.freedesktop.Telepathy.Connection.Interface.Requests + * + * 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 CONNIFACEREQPROXY_H_1284203341 +#define CONNIFACEREQPROXY_H_1284203341 + +#include +#include +#include +#include +#include +#include +#include +#include +#include "connectioninterfacerequeststypes.h" + +/* + * Proxy class for interface org.freedesktop.Telepathy.Connection.Interface.Requests + */ +class ConnectionInterfaceRequestsProxy: public QDBusAbstractInterface +{ + Q_OBJECT +public: + static inline const char *staticInterfaceName() + { return "org.freedesktop.Telepathy.Connection.Interface.Requests"; } + +public: + ConnectionInterfaceRequestsProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0); + + ~ConnectionInterfaceRequestsProxy(); + + Q_PROPERTY(org::freedesktop::Telepathy::RequestableChannelClassList RequestableChannelClasses READ requestableChannelClasses) + inline org::freedesktop::Telepathy::RequestableChannelClassList requestableChannelClasses() const + { return qvariant_cast< org::freedesktop::Telepathy::RequestableChannelClassList >(property("RequestableChannelClasses")); } + +public Q_SLOTS: // METHODS + inline QDBusPendingReply CreateChannel(const QVariantMap &request) + { + QList argumentList; + argumentList << qVariantFromValue(request); + return asyncCallWithArgumentList(QLatin1String("CreateChannel"), argumentList); + } + inline QDBusReply CreateChannel(const QVariantMap &request, QVariantMap &channel_properties) + { + QList argumentList; + argumentList << qVariantFromValue(request); + QDBusMessage reply = callWithArgumentList(QDBus::Block, QLatin1String("CreateChannel"), argumentList); + if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 2) { + channel_properties = qdbus_cast(reply.arguments().at(1)); + } + return reply; + } + + inline QDBusPendingReply EnsureChannel(const QVariantMap &request) + { + QList argumentList; + argumentList << qVariantFromValue(request); + return asyncCallWithArgumentList(QLatin1String("EnsureChannel"), argumentList); + } + inline QDBusReply EnsureChannel(const QVariantMap &request, QDBusObjectPath &channel_object, QVariantMap &channel_properties) + { + QList argumentList; + argumentList << qVariantFromValue(request); + QDBusMessage reply = callWithArgumentList(QDBus::Block, QLatin1String("EnsureChannel"), argumentList); + if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 3) { + channel_object = qdbus_cast(reply.arguments().at(1)); + channel_properties = qdbus_cast(reply.arguments().at(2)); + } + return reply; + } + +Q_SIGNALS: // SIGNALS + void ChannelClosed(const QDBusObjectPath &removed_channel_object); + void NewChannels(org::freedesktop::Telepathy::ChannelDetailsList new_channels); +}; + +namespace org { + namespace freedesktop { + namespace Telepathy { + namespace Connection { + namespace Interface { + typedef ::ConnectionInterfaceRequestsProxy Requests; + } + } + } + } +} +#endif diff --git a/src/vicar-lib/cpp/databaseutility.cpp b/src/vicar-lib/cpp/databaseutility.cpp new file mode 100644 index 0000000..e2df72b --- /dev/null +++ b/src/vicar-lib/cpp/databaseutility.cpp @@ -0,0 +1,203 @@ +#include "databaseutility.h" +#include +#include +#include +#include +#include +#include +#include + +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 "<"<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>"<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>"<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::getDefaultProfile(org::maemo::vicar::Profile *profile){ + bool result = false; + if (profilesDB.isOpen()){ + QString strQuery = QString("select * from profiles where numberpattern = '%' order by id"); + qDebug() << "SQL>"<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("profiles")){ + 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>"<"<"< +@license: GNU General Public License +*/ + +#ifndef DATABASEUTILITY_H +#define DATABASEUTILITY_H + +#include +#include "vicarprofiletypes.h" +#include +#include + +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 getDefaultProfile(org::maemo::vicar::Profile* profile); + bool deleteProfile(int id); + QSqlError lastError(); + +private: + QSqlDatabase profilesDB; +}; + +#endif // DATABASEUTILITY_H diff --git a/src/vicar-lib/cpp/dbusutility.cpp b/src/vicar-lib/cpp/dbusutility.cpp new file mode 100755 index 0000000..6e7b9ff --- /dev/null +++ b/src/vicar-lib/cpp/dbusutility.cpp @@ -0,0 +1,81 @@ +/* +@version: 0.6 +@author: Sudheer K. +@license: GNU General Public License +*/ + +#include "dbusutility.h" +#include +#include + + +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"; +} + +QDBusConnection DbusUtility::getConnection(bool systemBus){ + if (systemBus){ + if (!this->connection.isConnected()){ + qDebug() << "Not connected to Dbus"; + } + return this->connection; + } + else{ + return QDBusConnection::sessionBus(); + } +} + +void DbusUtility::setConnection(QDBusConnection connection){ + this->connection = connection; +} + +//Utility method to send a dbus signal. +bool DbusUtility::sendSignal(QString strPath,QString strInterface,QString strName,bool systemBus){ + QDBusMessage dbusSignal = QDBusMessage::createSignal(strPath,strInterface,strName); + QDBusConnection dbusConnection = getConnection(systemBus); + bool status = dbusConnection.send(dbusSignal); + return status; +} + +//Utility method to call a dbus method with parameters +bool DbusUtility::sendMethodCall(QString strService,QString strPath, + QString strInterface,QString strMethodName, + QList & arguments, + bool systemBus){ + QDBusMessage dbusMethodCall = QDBusMessage::createMethodCall(strService,strPath,strInterface,strMethodName); + dbusMethodCall.setArguments(arguments); + QDBusConnection dbusConnection = getConnection(systemBus); + bool status = dbusConnection.send(dbusMethodCall); + return status; +} + +//Utility method to display a notification (Orange sliding banner in Maemo) with custom message +bool DbusUtility::displayNotification(QString strMessage){ + QList arguments; + arguments.append(strMessage); + + bool status = this->sendMethodCall(NOTIFICATION_SERVICE, + NOTIFICATION_PATH, + NOTIFICATION_INTERFACE, + QString("SystemNoteInfoprint"), + arguments); + return status; +} + + +//Utility method to retrieve the last dbus error +QString DbusUtility::getErrorMessage(){ + QString strErrorMessage; + QDBusError dbusError = this->connection.lastError(); + if (dbusError.isValid()){ + strErrorMessage = qPrintable(dbusError.message()); + } + return strErrorMessage; +} diff --git a/src/vicar-lib/cpp/dbusutility.h b/src/vicar-lib/cpp/dbusutility.h new file mode 100755 index 0000000..f362b70 --- /dev/null +++ b/src/vicar-lib/cpp/dbusutility.h @@ -0,0 +1,35 @@ +/* +@version: 0.6 +@author: Sudheer K. +@license: GNU General Public License +*/ + +#ifndef DBUSUTILITY_H +#define DBUSUTILITY_H + +#include +#include + +#define NOTIFICATION_SERVICE "org.freedesktop.Notifications" +#define NOTIFICATION_PATH "/org/freedesktop/Notifications" +#define NOTIFICATION_INTERFACE "org.freedesktop.Notifications" + +class DbusUtility: public QObject +{ + Q_OBJECT +protected: + QDBusConnection connection; +public: + DbusUtility(QObject * parent = 0); + ~DbusUtility(); + QDBusConnection getConnection(bool systemBus = true); + void setConnection(QDBusConnection connection); + bool sendSignal(QString strPath,QString strInterface,QString strName,bool systemBus = true); + bool sendMethodCall(QString strService,QString strPath, + QString strInterface,QString strMethodName, + QList & arguments,bool systemBus = true); + bool displayNotification(QString strMessage); + QString getErrorMessage(); +}; + +#endif // DBUSUTILITY_H diff --git a/src/vicar-lib/cpp/gconfutility.cpp b/src/vicar-lib/cpp/gconfutility.cpp new file mode 100755 index 0000000..231a716 --- /dev/null +++ b/src/vicar-lib/cpp/gconfutility.cpp @@ -0,0 +1,105 @@ +/* +@version: 0.6 +@author: Sudheer K. +@license: GNU General Public License +*/ + +#include "gconfutility.h" +#include +#include + +GConfUtility::GConfUtility(QObject *parent) : + QObject(parent) +{ + /* Get a GConf client */ + gconfClient = gconf_client_get_default(); + g_assert(GCONF_IS_CLIENT(gconfClient)); +} + +GConfUtility::~GConfUtility(){ + /* release GConf client */ + g_object_unref(gconfClient); + gconfClient = 0; +} + +QString GConfUtility::getGconfValueString(QString strKey){ + + char* strValue = NULL; + + if (!strKey.isEmpty()) { + strKey.prepend(GCONF_DIR); + + strValue = gconf_client_get_string(gconfClient, strKey.toAscii().constData(), NULL); + qDebug() << "Gconf: "< +@license: GNU General Public License +*/ + +#ifndef GCONFUTILITY_H +#define GCONFUTILITY_H + +#include +#include + +#define APPLICATION_NAME "vicar" +#define GCONF_DIR "/apps/Maemo/" APPLICATION_NAME "/" + +class GConfUtility : public QObject + { +Q_OBJECT +public: + GConfUtility(QObject *parent = 0); + ~GConfUtility(); + void setGconfValueString(QString strKey,QString strValue); + QString getGconfValueString(QString strKey); + + void setGconfValueBoolean(QString strKey,bool boolValue); + bool getGconfValueBoolean(QString strKey); + + void setGconfValueInteger(QString strKey,int intValue); + int getGconfValueInteger(QString strKey); + +private: + GConfClient *gconfClient; +}; + +#endif // GCONFUTILITY_H diff --git a/src/vicar-lib/cpp/harmattanaccountutility.cpp b/src/vicar-lib/cpp/harmattanaccountutility.cpp new file mode 100644 index 0000000..7331977 --- /dev/null +++ b/src/vicar-lib/cpp/harmattanaccountutility.cpp @@ -0,0 +1,100 @@ +#if defined(Q_WS_MAEMO_6) + +#include "harmattanaccountutility.h" +#include +#include +#include +#include + +#define SERVICE_NAME "vicar" +#define SERVICE_TYPE "IM" +#define PROVIDER_NAME "vicar" + + +using namespace Accounts; + +HarmattanAccountUtility::HarmattanAccountUtility() +{ + manager = new Manager(this); +} + +Account* HarmattanAccountUtility::getAccount(){ + Account *vicarAccount = NULL; + //AccountIdList accountsList = manager->accountList(SERVICE_TYPE); + AccountIdList accountsList = manager->accountList(); + + for (int i = 0; i < accountsList.size(); i++) { + Account *tempAccount = manager->account(accountsList.at(i)); + if (tempAccount->providerName() == PROVIDER_NAME){ + qDebug() << "Account exists"; + return tempAccount; + } + else { + qDebug () << tempAccount->valueAsString("username") << "with provider " << tempAccount->providerName() <<" ignored"; + } + } + + qDebug() << "Account does not exist"; + return vicarAccount; +} + +Account* HarmattanAccountUtility::addAccount(){ + Account *vicarAccount; + vicarAccount = getAccount(); + if (vicarAccount == NULL){ + qDebug() << "Creating new account"; + vicarAccount = manager->createAccount(PROVIDER_NAME); + if (vicarAccount != NULL) { + qDebug() << "Account object created"; + connect(vicarAccount,SIGNAL(error(Accounts::Error)),SLOT(errorOccurred(Accounts::Error))); + vicarAccount->setDisplayName("VicarAccount"); + vicarAccount->setValue("username","vicar"); + vicarAccount->setValue("name","Call via Vicar"); + vicarAccount->setEnabled(true); //Set account as enabled globally + Service *vicarService = manager->service(SERVICE_NAME); + vicarAccount->selectService(vicarService); + vicarAccount->setEnabled(true); //Set account as enabled at service level + vicarAccount->setValue("ConnectAutomatically","true"); + vicarAccount->setValue("HasBeenOnline","true"); + vicarAccount->setValue("NormalizedName","Vicar"); + vicarAccount->setValue("org.freedesktop.Telepathy.Account.Interface.Addressing.DRAFT.URISchemes","tel;"); + vicarAccount->setValue("tmc-uid","vicar/tel/vicar0"); + vicarAccount->sync(); + qDebug() << "Account created with ID " << vicarAccount->id(); + } + else{ + qDebug() << "Account not created due to error "<< manager->lastError().message(); + } + } + else{ + qDebug() << "Account already exists. No need to create again"; + } + return vicarAccount; +} + +void HarmattanAccountUtility::removeAccount(){ + Account *vicarAccount = getAccount(); + if (vicarAccount != NULL && vicarAccount != 0){ + vicarAccount->remove(); + vicarAccount->sync(); + qDebug() << "Account deleted"; + delete vicarAccount; + } +} + +void HarmattanAccountUtility::verifyAccount(){ + Account *vicarAccount = getAccount(); + if (vicarAccount != NULL && vicarAccount != 0){ + Service *vicarService = manager->service(SERVICE_NAME); + vicarAccount->selectService(vicarService); + QStringList keysList = vicarAccount->allKeys(); + qDebug() << keysList; + delete vicarAccount; + } +} + +void HarmattanAccountUtility::errorOccurred(Accounts::Error error){ + qDebug() << "Error is "<< error.message(); +} + +#endif //defined(Q_WS_MAEMO_6) diff --git a/src/vicar-lib/cpp/harmattanaccountutility.h b/src/vicar-lib/cpp/harmattanaccountutility.h new file mode 100644 index 0000000..9013e84 --- /dev/null +++ b/src/vicar-lib/cpp/harmattanaccountutility.h @@ -0,0 +1,35 @@ +#ifndef HARMATTANACCOUNTUTILITY_H +#define HARMATTANACCOUNTUTILITY_H + +#if defined(Q_WS_MAEMO_6) + +#include + +#include +#include +#include + +using namespace Accounts; + +class HarmattanAccountUtility : public QObject +{ + Q_OBJECT + +public: + HarmattanAccountUtility(); + Account* getAccount(); + Account* addAccount(); + void removeAccount(); + void verifyAccount(); + +public slots: + void errorOccurred(Accounts::Error); + +private: + Manager *manager; + +}; + +#endif //defined (Q_WS_MAEMO_6) + +#endif // HARMATTANACCOUNTUTILITY_H diff --git a/src/vicar-lib/cpp/logutility.h b/src/vicar-lib/cpp/logutility.h new file mode 100644 index 0000000..ebca69e --- /dev/null +++ b/src/vicar-lib/cpp/logutility.h @@ -0,0 +1,56 @@ +/* +@version: 0.6 +@author: Sudheer K. +@license: GNU General Public License +*/ + +#ifndef LOGUTILITY_H +#define LOGUTILITY_H +#include +#include +#include +#include +#include + +class LogUtility : public QObject +{ + Q_OBJECT + +public: + LogUtility(QString logPath,QObject *parent = 0) : + QObject(parent){ + logFilePath = logPath; + } + + ~LogUtility(){ + } + +public slots: + void logMessage(QString strMessage, bool appendMode = true) { + + QFile logFile(logFilePath); + + bool success = false; + + if (appendMode){ + success = logFile.open(QIODevice::Append | QIODevice::WriteOnly | QIODevice::Text); + } + else{ + success = logFile.open(QIODevice::Truncate | QIODevice::WriteOnly | QIODevice::Text); + } + + QString strTimeNow = QDateTime::currentDateTime().toString("dd-MMM-yyyy HH:mm:ss"); + if (success) { + QTextStream logStream(&logFile); + logStream << strTimeNow << " - " << strMessage << endl; + } + else{ + qDebug() << "ERROROPENINGLOGFILE" << " - " << strMessage; + } + } + +private: + QString logFilePath; +}; + +#endif // LOGUTILITY_H diff --git a/src/vicar-lib/cpp/telepathyutility.cpp b/src/vicar-lib/cpp/telepathyutility.cpp new file mode 100644 index 0000000..068f3fe --- /dev/null +++ b/src/vicar-lib/cpp/telepathyutility.cpp @@ -0,0 +1,247 @@ +/* +@version: 0.6 +@author: Sudheer K. +@license: GNU General Public License +*/ + +#include "telepathyutility.h" +#include "accountmanagerproxy.h" +#include "accountproxy.h" +#include "accountcompatproxy.h" +#include "connifacereqproxy.h" +#include +#include +#include +#include +#include +#include + +using namespace org::freedesktop::Telepathy; + +TelepathyUtility::TelepathyUtility(QObject *parent) : + QObject(parent) +{ +} + +TelepathyUtility::~TelepathyUtility(){ + +} + +//Get a list of all Telepathy accounts +QList TelepathyUtility::getAllAccounts(){ + + QList objPathList; + + QDBusInterface *iface = new QDBusInterface(AM_SERVICE,AM_OBJ_PATH,DBUS_PROPS_IFACE,QDBusConnection::sessionBus(),this); + if (iface->isValid()){ + QDBusReply 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(); + + 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 "< 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 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 during installation) +bool TelepathyUtility::createAccount(){ + + AccountManagerProxy *amProxy = new AccountManagerProxy(AM_SERVICE,AM_OBJ_PATH,QDBusConnection::sessionBus(),this); + + QMap connectionParametersMap; + connectionParametersMap.insert("account","vicar"); + + QList presenceDetails; + uint presenceType(2); //Available = 2 + presenceDetails << presenceType; + presenceDetails << "available"; + presenceDetails << "Available"; + + SimplePresence presence; + presence.type = presenceType; + presence.status = "available"; + presence.statusMessage = "Available"; + + QMap 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("org.freedesktop.Telepathy.Account.Service","vicar"); //Required when service can't be determined by the protocol name + accountPropertiesMap.insert("com.nokia.Account.Interface.Compat.Profile","vicar"); + + QStringList valuesList; + valuesList.append("TEL"); + accountPropertiesMap.insert("com.nokia.Account.Interface.Compat.SecondaryVCardFields",valuesList); + + //QStringList uriSchemeList; + //uriSchemeList.append("tel"); + //accountPropertiesMap.insert("org.freedesktop.Telepathy.Account.Interface.Addressing.DRAFT.URISchemes",uriSchemeList); + + QDBusPendingReply 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 "< 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 "<isValid()){ + QVariantMap channelRequestDetails; + uint targetHandleType(1); + channelRequestDetails.insert("org.freedesktop.Telepathy.Channel.TargetHandleType",targetHandleType); + channelRequestDetails.insert("org.freedesktop.Telepathy.Channel.TargetID",number); + channelRequestDetails.insert("org.freedesktop.Telepathy.Channel.ChannelType","org.freedesktop.Telepathy.Channel.Type.StreamedMedia"); + QDBusPendingReply dbusReply = requestsProxy->CreateChannel(channelRequestDetails); + dbusReply.waitForFinished(); + if (!dbusReply.isError()){ + QDBusObjectPath objPath = dbusReply.argumentAt<0>(); + QVariantMap channelProperties = dbusReply.argumentAt<1>(); + result = true; + } + else{ + qDebug() << "Error occurred calling "<>(const QDBusArgument &argument, SimplePresence &simplePresence) + { + argument.beginStructure(); + argument >> simplePresence.type >> simplePresence.status >> simplePresence.statusMessage; + argument.endStructure(); + return argument; + } diff --git a/src/vicar-lib/cpp/telepathyutility.h b/src/vicar-lib/cpp/telepathyutility.h new file mode 100644 index 0000000..56f0147 --- /dev/null +++ b/src/vicar-lib/cpp/telepathyutility.h @@ -0,0 +1,62 @@ +/* +@version: 0.6 +@author: Sudheer K. +@license: GNU General Public License +*/ + +#ifndef TELEPATHYUTILITY_H +#define TELEPATHYUTILITY_H + +#include +#include +#include + + +#define AM_SERVICE "org.freedesktop.Telepathy.AccountManager" +#define AM_OBJ_PATH "/org/freedesktop/Telepathy/AccountManager" +#define AM_INTERFACE "org.freedesktop.Telepathy.AccountManager" +#define RING_CONN_SERVICE "org.freedesktop.Telepathy.Connection.ring.tel.ring" +#define RING_CONN_PATH "/org/freedesktop/Telepathy/Connection/ring/tel/ring" +#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 getAllAccounts(); + QString getAccountStatus(); + bool accountExists(); + bool createAccount(); + bool deleteAccount(); + bool callNumberWithRing(QString number); + bool sendDTMFTone(QString tone); +}; + +#endif // TELEPATHYUTILITY_H diff --git a/src/vicar-lib/cpp/vicarprofiletypes.h b/src/vicar-lib/cpp/vicarprofiletypes.h new file mode 100644 index 0000000..c43a580 --- /dev/null +++ b/src/vicar-lib/cpp/vicarprofiletypes.h @@ -0,0 +1,31 @@ +#ifndef VICARPROFILETYPES_H +#define VICARPROFILETYPES_H + +#include +#include +#include + +namespace org { +namespace maemo { +namespace vicar { + +class Profile +{ +public: + uint profileID; + QString phoneNumberPattern; + QString gatewayNumber; + QString dtmfFormat; + QString dtmfPrefix; + QString dtmfSuffix; +}; +typedef QList ProfileList; + +} // namespace vicar +} // namespace maemo +} // namespace org + +Q_DECLARE_METATYPE(org::maemo::vicar::Profile) +Q_DECLARE_METATYPE(org::maemo::vicar::ProfileList) + +#endif // VICARPROFILETYPES_H diff --git a/src/vicar-lib/src/accountcompatproxy.cpp b/src/vicar-lib/src/accountcompatproxy.cpp deleted file mode 100644 index 97ffd81..0000000 --- a/src/vicar-lib/src/accountcompatproxy.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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 deleted file mode 100644 index 024eba6..0000000 --- a/src/vicar-lib/src/accountcompatproxy.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 -#include -#include -#include -#include -#include -#include -#include - -/* - * 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 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 deleted file mode 100644 index bdb9ac2..0000000 --- a/src/vicar-lib/src/accountmanagerproxy.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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 deleted file mode 100644 index 10a97b9..0000000 --- a/src/vicar-lib/src/accountmanagerproxy.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 -#include -#include -#include -#include -#include -#include -#include - -/* - * 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 CreateAccount(const QString &Connection_Manager, const QString &Protocol, const QString &Display_Name, const QVariantMap &Parameters, const QVariantMap &Properties) - { - QList 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 deleted file mode 100644 index d6a4934..0000000 --- a/src/vicar-lib/src/accountproxy.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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 deleted file mode 100644 index 0f97df2..0000000 --- a/src/vicar-lib/src/accountproxy.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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 -#include -#include -#include -#include -#include -#include -#include - -/* - * 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 argumentList; - return asyncCallWithArgumentList(QLatin1String("Reconnect"), argumentList); - } - - inline QDBusPendingReply<> Remove() - { - QList argumentList; - return asyncCallWithArgumentList(QLatin1String("Remove"), argumentList); - } - - inline QDBusPendingReply UpdateParameters(const QVariantMap &Set, const QStringList &Unset) - { - QList 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/connectioninterfacerequeststypes.cpp b/src/vicar-lib/src/connectioninterfacerequeststypes.cpp deleted file mode 100644 index d0546a5..0000000 --- a/src/vicar-lib/src/connectioninterfacerequeststypes.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@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 - * - * 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-lib/src/connectioninterfacerequeststypes.h b/src/vicar-lib/src/connectioninterfacerequeststypes.h deleted file mode 100644 index 8f1fab9..0000000 --- a/src/vicar-lib/src/connectioninterfacerequeststypes.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@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 - * Copyright (C) 2006 by INdT - * @author Andre Moreira Magalhaes - * - * 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 -#include -#include -#include -#include - -namespace org { -namespace freedesktop { -namespace Telepathy { - -class ChannelDetails -{ -public: - QDBusObjectPath channel; - QVariantMap properties; -}; -typedef QList ChannelDetailsList; - -class RequestableChannelClass -{ -public: - QVariantMap fixedProperties; - QStringList allowedProperties; -}; -typedef QList 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-lib/src/connifacereqproxy.cpp b/src/vicar-lib/src/connifacereqproxy.cpp deleted file mode 100644 index abef41c..0000000 --- a/src/vicar-lib/src/connifacereqproxy.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This file was generated by qdbusxml2cpp version 0.7 - * Command line was: qdbusxml2cpp -c ConnectionInterfaceRequestsProxy -p connifacereqproxy.h:connifacereqproxy.cpp org.freedesktop.Telepathy.Connection.I.Requests.xml org.freedesktop.Telepathy.Connection.Interface.Requests - * - * 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 "connifacereqproxy.h" - -/* - * Implementation of interface class ConnectionInterfaceRequestsProxy - */ - -ConnectionInterfaceRequestsProxy::ConnectionInterfaceRequestsProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) - : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) -{ -} - -ConnectionInterfaceRequestsProxy::~ConnectionInterfaceRequestsProxy() -{ -} - diff --git a/src/vicar-lib/src/connifacereqproxy.h b/src/vicar-lib/src/connifacereqproxy.h deleted file mode 100644 index c53359a..0000000 --- a/src/vicar-lib/src/connifacereqproxy.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * This file was generated by qdbusxml2cpp version 0.7 - * Command line was: qdbusxml2cpp -c ConnectionInterfaceRequestsProxy -p connifacereqproxy.h:connifacereqproxy.cpp org.freedesktop.Telepathy.Connection.I.Requests.xml org.freedesktop.Telepathy.Connection.Interface.Requests - * - * 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 CONNIFACEREQPROXY_H_1284203341 -#define CONNIFACEREQPROXY_H_1284203341 - -#include -#include -#include -#include -#include -#include -#include -#include -#include "connectioninterfacerequeststypes.h" - -/* - * Proxy class for interface org.freedesktop.Telepathy.Connection.Interface.Requests - */ -class ConnectionInterfaceRequestsProxy: public QDBusAbstractInterface -{ - Q_OBJECT -public: - static inline const char *staticInterfaceName() - { return "org.freedesktop.Telepathy.Connection.Interface.Requests"; } - -public: - ConnectionInterfaceRequestsProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0); - - ~ConnectionInterfaceRequestsProxy(); - - Q_PROPERTY(org::freedesktop::Telepathy::RequestableChannelClassList RequestableChannelClasses READ requestableChannelClasses) - inline org::freedesktop::Telepathy::RequestableChannelClassList requestableChannelClasses() const - { return qvariant_cast< org::freedesktop::Telepathy::RequestableChannelClassList >(property("RequestableChannelClasses")); } - -public Q_SLOTS: // METHODS - inline QDBusPendingReply CreateChannel(const QVariantMap &request) - { - QList argumentList; - argumentList << qVariantFromValue(request); - return asyncCallWithArgumentList(QLatin1String("CreateChannel"), argumentList); - } - inline QDBusReply CreateChannel(const QVariantMap &request, QVariantMap &channel_properties) - { - QList argumentList; - argumentList << qVariantFromValue(request); - QDBusMessage reply = callWithArgumentList(QDBus::Block, QLatin1String("CreateChannel"), argumentList); - if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 2) { - channel_properties = qdbus_cast(reply.arguments().at(1)); - } - return reply; - } - - inline QDBusPendingReply EnsureChannel(const QVariantMap &request) - { - QList argumentList; - argumentList << qVariantFromValue(request); - return asyncCallWithArgumentList(QLatin1String("EnsureChannel"), argumentList); - } - inline QDBusReply EnsureChannel(const QVariantMap &request, QDBusObjectPath &channel_object, QVariantMap &channel_properties) - { - QList argumentList; - argumentList << qVariantFromValue(request); - QDBusMessage reply = callWithArgumentList(QDBus::Block, QLatin1String("EnsureChannel"), argumentList); - if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() == 3) { - channel_object = qdbus_cast(reply.arguments().at(1)); - channel_properties = qdbus_cast(reply.arguments().at(2)); - } - return reply; - } - -Q_SIGNALS: // SIGNALS - void ChannelClosed(const QDBusObjectPath &removed_channel_object); - void NewChannels(org::freedesktop::Telepathy::ChannelDetailsList new_channels); -}; - -namespace org { - namespace freedesktop { - namespace Telepathy { - namespace Connection { - namespace Interface { - typedef ::ConnectionInterfaceRequestsProxy Requests; - } - } - } - } -} -#endif diff --git a/src/vicar-lib/src/databaseutility.cpp b/src/vicar-lib/src/databaseutility.cpp deleted file mode 100644 index e2df72b..0000000 --- a/src/vicar-lib/src/databaseutility.cpp +++ /dev/null @@ -1,203 +0,0 @@ -#include "databaseutility.h" -#include -#include -#include -#include -#include -#include -#include - -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 "<"<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>"<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>"<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::getDefaultProfile(org::maemo::vicar::Profile *profile){ - bool result = false; - if (profilesDB.isOpen()){ - QString strQuery = QString("select * from profiles where numberpattern = '%' order by id"); - qDebug() << "SQL>"<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("profiles")){ - 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>"<"<"< -@license: GNU General Public License -*/ - -#ifndef DATABASEUTILITY_H -#define DATABASEUTILITY_H - -#include -#include "vicarprofiletypes.h" -#include -#include - -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 getDefaultProfile(org::maemo::vicar::Profile* profile); - bool deleteProfile(int id); - QSqlError lastError(); - -private: - QSqlDatabase profilesDB; -}; - -#endif // DATABASEUTILITY_H diff --git a/src/vicar-lib/src/dbusutility.cpp b/src/vicar-lib/src/dbusutility.cpp deleted file mode 100755 index ae8458f..0000000 --- a/src/vicar-lib/src/dbusutility.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@license: GNU General Public License -*/ - -#include "dbusutility.h" -#include -#include - - -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"; -} - -QDBusConnection DbusUtility::getConnection(bool systemBus){ - if (systemBus){ - if (!this->connection.isConnected()){ - qDebug() << "Not connected to Dbus"; - } - return this->connection; - } - else{ - return QDBusConnection::sessionBus(); - } -} - -void DbusUtility::setConnection(QDBusConnection connection){ - this->connection = connection; -} - -//Utility method to send a dbus signal. -bool DbusUtility::sendSignal(QString strPath,QString strInterface,QString strName){ - QDBusMessage dbusSignal = QDBusMessage::createSignal(strPath,strInterface,strName); - bool status = DbusUtility::connection.send(dbusSignal); - return status; -} - -//Utility method to call a dbus method with parameters -bool DbusUtility::sendMethodCall(QString strService,QString strPath, - QString strInterface,QString strMethodName, - QList & arguments){ - QDBusMessage dbusMethodCall = QDBusMessage::createMethodCall(strService,strPath,strInterface,strMethodName); - dbusMethodCall.setArguments(arguments); - bool status = DbusUtility::connection.send(dbusMethodCall); - return status; -} - -//Utility method to display a notification (Orange sliding banner in Maemo) with custom message -bool DbusUtility::displayNotification(QString strMessage){ - QList arguments; - arguments.append(strMessage); - - bool status = this->sendMethodCall(NOTIFICATION_SERVICE, - NOTIFICATION_PATH, - NOTIFICATION_INTERFACE, - QString("SystemNoteInfoprint"), - arguments); - return status; -} - - -//Utility method to retrieve the last dbus error -QString DbusUtility::getErrorMessage(){ - QString strErrorMessage; - QDBusError dbusError = this->connection.lastError(); - if (dbusError.isValid()){ - strErrorMessage = qPrintable(dbusError.message()); - } - return strErrorMessage; -} diff --git a/src/vicar-lib/src/dbusutility.h b/src/vicar-lib/src/dbusutility.h deleted file mode 100755 index 99077a0..0000000 --- a/src/vicar-lib/src/dbusutility.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@license: GNU General Public License -*/ - -#ifndef DBUSUTILITY_H -#define DBUSUTILITY_H - -#include -#include - -#define NOTIFICATION_SERVICE "org.freedesktop.Notifications" -#define NOTIFICATION_PATH "/org/freedesktop/Notifications" -#define NOTIFICATION_INTERFACE "org.freedesktop.Notifications" - -class DbusUtility: public QObject -{ - Q_OBJECT -protected: - QDBusConnection connection; -public: - DbusUtility(QObject * parent = 0); - ~DbusUtility(); - QDBusConnection getConnection(bool systemBus = true); - void setConnection(QDBusConnection connection); - bool sendSignal(QString strPath,QString strInterface,QString strName); - bool sendMethodCall(QString strService,QString strPath, - QString strInterface,QString strMethodName, - QList & arguments); - bool displayNotification(QString strMessage); - QString getErrorMessage(); -}; - -#endif // DBUSUTILITY_H diff --git a/src/vicar-lib/src/gconfutility.cpp b/src/vicar-lib/src/gconfutility.cpp deleted file mode 100755 index 231a716..0000000 --- a/src/vicar-lib/src/gconfutility.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@license: GNU General Public License -*/ - -#include "gconfutility.h" -#include -#include - -GConfUtility::GConfUtility(QObject *parent) : - QObject(parent) -{ - /* Get a GConf client */ - gconfClient = gconf_client_get_default(); - g_assert(GCONF_IS_CLIENT(gconfClient)); -} - -GConfUtility::~GConfUtility(){ - /* release GConf client */ - g_object_unref(gconfClient); - gconfClient = 0; -} - -QString GConfUtility::getGconfValueString(QString strKey){ - - char* strValue = NULL; - - if (!strKey.isEmpty()) { - strKey.prepend(GCONF_DIR); - - strValue = gconf_client_get_string(gconfClient, strKey.toAscii().constData(), NULL); - qDebug() << "Gconf: "< -@license: GNU General Public License -*/ - -#ifndef GCONFUTILITY_H -#define GCONFUTILITY_H - -#include -#include - -#define APPLICATION_NAME "vicar" -#define GCONF_DIR "/apps/Maemo/" APPLICATION_NAME "/" - -class GConfUtility : public QObject - { -Q_OBJECT -public: - GConfUtility(QObject *parent = 0); - ~GConfUtility(); - void setGconfValueString(QString strKey,QString strValue); - QString getGconfValueString(QString strKey); - - void setGconfValueBoolean(QString strKey,bool boolValue); - bool getGconfValueBoolean(QString strKey); - - void setGconfValueInteger(QString strKey,int intValue); - int getGconfValueInteger(QString strKey); - -private: - GConfClient *gconfClient; -}; - -#endif // GCONFUTILITY_H diff --git a/src/vicar-lib/src/telepathyutility.cpp b/src/vicar-lib/src/telepathyutility.cpp deleted file mode 100644 index f75681b..0000000 --- a/src/vicar-lib/src/telepathyutility.cpp +++ /dev/null @@ -1,242 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@license: GNU General Public License -*/ - -#include "telepathyutility.h" -#include "accountmanagerproxy.h" -#include "accountproxy.h" -#include "accountcompatproxy.h" -#include "connifacereqproxy.h" -#include -#include -#include -#include -#include -#include - -using namespace org::freedesktop::Telepathy; - -TelepathyUtility::TelepathyUtility(QObject *parent) : - QObject(parent) -{ -} - -TelepathyUtility::~TelepathyUtility(){ - -} - -//Get a list of all Telepathy accounts -QList TelepathyUtility::getAllAccounts(){ - - QList objPathList; - - QDBusInterface *iface = new QDBusInterface(AM_SERVICE,AM_OBJ_PATH,DBUS_PROPS_IFACE,QDBusConnection::sessionBus(),this); - if (iface->isValid()){ - QDBusReply 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(); - - 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 "< 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 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 during installation) -bool TelepathyUtility::createAccount(){ - - AccountManagerProxy *amProxy = new AccountManagerProxy(AM_SERVICE,AM_OBJ_PATH,QDBusConnection::sessionBus(),this); - - QMap connectionParametersMap; - connectionParametersMap.insert("account","vicar"); - - QList presenceDetails; - uint presenceType(2); //Available = 2 - presenceDetails << presenceType; - presenceDetails << "online"; - presenceDetails << "Available"; - - SimplePresence presence; - presence.type = presenceType; - presence.status = "online"; - presence.statusMessage = "Available"; - - QMap 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 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 "< 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 "<isValid()){ - QVariantMap channelRequestDetails; - uint targetHandleType(1); - channelRequestDetails.insert("org.freedesktop.Telepathy.Channel.TargetHandleType",targetHandleType); - channelRequestDetails.insert("org.freedesktop.Telepathy.Channel.TargetID",number); - channelRequestDetails.insert("org.freedesktop.Telepathy.Channel.ChannelType","org.freedesktop.Telepathy.Channel.Type.StreamedMedia"); - QDBusPendingReply dbusReply = requestsProxy->CreateChannel(channelRequestDetails); - dbusReply.waitForFinished(); - if (!dbusReply.isError()){ - QDBusObjectPath objPath = dbusReply.argumentAt<0>(); - QVariantMap channelProperties = dbusReply.argumentAt<1>(); - result = true; - } - else{ - qDebug() << "Error occurred calling "<>(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 deleted file mode 100644 index 56f0147..0000000 --- a/src/vicar-lib/src/telepathyutility.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@license: GNU General Public License -*/ - -#ifndef TELEPATHYUTILITY_H -#define TELEPATHYUTILITY_H - -#include -#include -#include - - -#define AM_SERVICE "org.freedesktop.Telepathy.AccountManager" -#define AM_OBJ_PATH "/org/freedesktop/Telepathy/AccountManager" -#define AM_INTERFACE "org.freedesktop.Telepathy.AccountManager" -#define RING_CONN_SERVICE "org.freedesktop.Telepathy.Connection.ring.tel.ring" -#define RING_CONN_PATH "/org/freedesktop/Telepathy/Connection/ring/tel/ring" -#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 getAllAccounts(); - QString getAccountStatus(); - bool accountExists(); - bool createAccount(); - bool deleteAccount(); - bool callNumberWithRing(QString number); - bool sendDTMFTone(QString tone); -}; - -#endif // TELEPATHYUTILITY_H diff --git a/src/vicar-lib/src/vicarprofiletypes.h b/src/vicar-lib/src/vicarprofiletypes.h deleted file mode 100644 index c43a580..0000000 --- a/src/vicar-lib/src/vicarprofiletypes.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef VICARPROFILETYPES_H -#define VICARPROFILETYPES_H - -#include -#include -#include - -namespace org { -namespace maemo { -namespace vicar { - -class Profile -{ -public: - uint profileID; - QString phoneNumberPattern; - QString gatewayNumber; - QString dtmfFormat; - QString dtmfPrefix; - QString dtmfSuffix; -}; -typedef QList ProfileList; - -} // namespace vicar -} // namespace maemo -} // namespace org - -Q_DECLARE_METATYPE(org::maemo::vicar::Profile) -Q_DECLARE_METATYPE(org::maemo::vicar::ProfileList) - -#endif // VICARPROFILETYPES_H diff --git a/src/vicar-lib/vicar-lib.pro b/src/vicar-lib/vicar-lib.pro index 543e1e1..725dd40 100755 --- a/src/vicar-lib/vicar-lib.pro +++ b/src/vicar-lib/vicar-lib.pro @@ -1,42 +1,46 @@ -INCLUDEPATH += /usr/include/gconf/2 \ - /usr/include/glib-2.0 \ - /usr/lib/glib-2.0/include -#QMAKE_LIBDIR=./ -LIBS += /usr/lib/libgconf-2.so -CONFIG += qt debug staticlib +CONFIG += link_pkgconfig +PKGCONFIG += glib-2.0 gconf-2.0 + +contains(MEEGO_EDITION,harmattan){ + DEFINES += Q_WS_MAEMO_6 + PKGCONFIG += accounts-qt +} + +CONFIG += qt debug staticlib core xml CONFIG -= gui QT += dbus sql QT -= gui + TARGET = vicar TEMPLATE = lib -VPATH += src -MOC_DIR = mocs -OBJECTS_DIR = objs +VPATH += cpp +MOC_DIR = cpp/.mocs +OBJECTS_DIR = cpp/.objs DESTDIR = ../lib -SOURCES += src/dbusutility.cpp \ - src/gconfutility.cpp \ - src/telepathyutility.cpp \ - src/accountmanagerproxy.cpp \ - src/accountproxy.cpp \ - src/accountcompatproxy.cpp \ - src/connifacereqproxy.cpp \ - src/connectioninterfacerequeststypes.cpp \ - src/databaseutility.cpp -HEADERS += src/dbusutility.h \ - src/gconfutility.h \ - src/telepathyutility.h \ - src/accountmanagerproxy.h \ - src/accountproxy.h \ - src/accountcompatproxy.h \ - src/connifacereqproxy.h \ - src/connectioninterfacerequeststypes.h \ - src/databaseutility.h \ - src/vicarprofiletypes.h - -#MAKE INSTALL -INSTALLDIR = /../../debian/vicar +SOURCES += cpp/dbusutility.cpp \ + cpp/gconfutility.cpp \ + cpp/telepathyutility.cpp \ + cpp/accountmanagerproxy.cpp \ + cpp/accountproxy.cpp \ + cpp/accountcompatproxy.cpp \ + cpp/connifacereqproxy.cpp \ + cpp/connectioninterfacerequeststypes.cpp \ + cpp/databaseutility.cpp \ + cpp/harmattanaccountutility.cpp +HEADERS += cpp/dbusutility.h \ + cpp/gconfutility.h \ + cpp/telepathyutility.h \ + cpp/accountmanagerproxy.h \ + cpp/accountproxy.h \ + cpp/accountcompatproxy.h \ + cpp/connifacereqproxy.h \ + cpp/connectioninterfacerequeststypes.h \ + cpp/databaseutility.h \ + cpp/vicarprofiletypes.h \ + cpp/logutility.h \ + cpp/harmattanaccountutility.h INSTALLS += target +target.path =/opt/vicar/lib -target.path =$$INSTALLDIR/opt/lib diff --git a/src/vicar-telepathy/cpp/basetypes.h b/src/vicar-telepathy/cpp/basetypes.h new file mode 100644 index 0000000..28ddabd --- /dev/null +++ b/src/vicar-telepathy/cpp/basetypes.h @@ -0,0 +1,35 @@ +/* + * QtTelepathy, the Tapioca Qt4 Telepathy Client Library + * Copyright (C) 2006 by Tobias Hunger + * Copyright (C) 2006 by INdT + * @author Andre Moreira Magalhaes + * + * 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 +#include +#include +#include +#include + +Q_DECLARE_METATYPE(QList) +Q_DECLARE_METATYPE(QVariantMap) + +#endif + diff --git a/src/vicar-telepathy/cpp/connection.cpp b/src/vicar-telepathy/cpp/connection.cpp new file mode 100644 index 0000000..58bbe92 --- /dev/null +++ b/src/vicar-telepathy/cpp/connection.cpp @@ -0,0 +1,614 @@ +/* +@version: 0.6 +@author: Sudheer K. +@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 + * + * 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 Street, 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 + +#include +#include +#include +#include +#include + + +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)), + logUtility(new LogUtility("/var/log/vicar/vicar.log",p)), + parent(p) + { + Q_ASSERT(0 != adaptor); + } + + ~ConnectionPrivate() + { + qDebug() << "VICaR Connection: Connection Destructing"; + } + + const QString account; + + Connection::Status connection_status; + ConnectionAdaptor * adaptor; + ConnectionInterfaceRequestsAdaptor * connIfaceReqsAdaptor; + LogUtility * const logUtility; + Connection * const parent; +}; + +// --------------------------------------------------------------------------- + +Connection::Connection(const QString & account, + QObject * parent) : + QObject(parent), + d(new ConnectionPrivate(this, account)) +{ + + QString strMessage; + strMessage = "DEBUG: In Connection Constructor"; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + + 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 Dynamic property "HasImmortalHandles" to true as per telepathy Connection spec 0.21.6 + //The handles for vicar connection are expected to last throughout the lifetime of the connection + this->setProperty("HasImmortalHandles",true); + + this->setProperty("Status",org::freedesktop::Telepathy::CONNECTION_STATUS_CONNECTED); + this->setProperty("SelfHandle",org::freedesktop::Telepathy::HANDLE_TYPE_CONTACT); + + //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)); + + //Set the property Channels + org::freedesktop::Telepathy::ChannelDetailsList channelDetails; + this->setProperty("Channels",QVariant::fromValue(channelDetails)); + + //Set the connection status to Connected (default for Vicar) + d->connection_status = Connection::Connected; + + + strMessage = "VICaR Connection: Connection set up."; + + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); +} + +Connection::~Connection() +{ + qDebug() << "VICaR Connection: Connection closed."; + delete(d); +} + +bool Connection::registerObject() +{ + QString strMessage; + + if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(serviceName())){ + if (!QDBusConnection::sessionBus().registerService(serviceName())) + { + strMessage = "VICaR Connection: Problem registering connection service:" + serviceName(); + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + return false; + } + + if (!QDBusConnection::sessionBus().registerObject(objectPath().path(), + this)) + { + strMessage = "VICaR Connection: Problem registering object path:" + objectPath().path(); + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + return false; + } + } + else{ + strMessage = "VICaR Connection: " + serviceName()+" is already registered on DBus"; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + } + return true; +} + +void Connection::unregisterObject() +{ + QString strMessage = "VICaR Connection: Unregistering Connection object from DBus"; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + 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. + */ + QString strMessage = "VICaR Connection: Changing status to Connected..."; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + d->connection_status = Connection::Connected; + + //Let all the Telepathy clients know that connection status has changed + strMessage = "VICaR Connection: Emitting StatusChanged."; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + emit StatusChanged(d->connection_status, ReasonRequested); +} + +void Connection::Disconnect() +{ + QString strMessage = "VICaR Connection: Changing status to Disconnected..."; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + //We don't have any Handles to release here. So just change the status to Disconnected + d->connection_status = Connection::Disconnected; + + strMessage = "VICaR Connection: Emitting StatusChanged"; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + 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 <(d->connection_status); } + +uint Connection::GetSelfHandle() +{ + QString strMessage = "VICaR Connection: GetSelfHandle"; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + if (d->connection_status != Connected) + { + sendErrorReply("org.freedesktop.Telepathy.Error.Disconnected", + "VICaR - Unable to get Self Handle. The connection is no longer available."); + strMessage = "VICaR Connection: NOT CONNECTED when requesting selfhandle!"; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + return 0; + } + + //WARNING: Incomplete implemenation + uint handle = 0; + strMessage = "VICaR Connection: Returning Handle " + QString(handle) + "as self handle."; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + return handle; +} + +QList Connection::RequestHandles(uint handle_type, + const QStringList & names) +{ + Q_UNUSED(names); + QList 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 &handles) +{ + Q_UNUSED(handles); + QString strMessage = "VICaR Connection: HoldHandles."; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + if (d->connection_status != Connected) + { + + strMessage = "VICaR Connection: HoldHandles - Not Connected."; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + + sendErrorReply("org.freedesktop.Telepathy.Error.Disconnected", + "VICaR - Unable to process handle request. The connection is no longer available."); + return; + } + if (handle_type != HandleContact) + { + + strMessage = "VICaR Connection: HoldHandles - Invalid Handle Type."; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + + 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 &handles) +{ + Q_UNUSED(handles); + QStringList handlesList; + + QString strMessage = "VICaR Connection: InspectHandles."; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + + // 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 handlesList; + } + if (handle_type != HandleContact) + { + sendErrorReply("org.freedesktop.Telepathy.Error.InvalidArgument", + "VICaR - Supports handles of type Contact only."); + return handlesList; + } + + uint handle = 0; + for (int i = 0 ; i < handles.length(); i++) { + handle = handles.at(i); + strMessage = "VICaR Connection: Inspecting handle "+QString(handle); + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + handlesList.append(QString(handle)); + } + + //WARNING: Incomplete implementation + return handlesList; +} + +void Connection::ReleaseHandles(const uint handle_type, const QList &handles) +{ + Q_UNUSED(handles); + QString strMessage; + if (d->connection_status != Connected) + { + sendErrorReply("org.freedesktop.Telepathy.Error.Disconnected", + "VICaR - Unable to release handle. The connection is no longer available."); + strMessage = "VICaR Connection: Releasing Handle while connection is no longer connected."; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + return; + } + if (handle_type != HandleContact) + { + sendErrorReply("org.freedesktop.Telepathy.Error.InvalidArgument", + "VICaR - Supports handles of type Contact only."); + strMessage = "VICaR Connection: Trying to release a Handle that is not a contact."; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + 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 Connection: Failed to create channel: Channel type not implemented."); + return QDBusObjectPath(); + } + + if (handle_type != HandleContact ) + { + sendErrorReply("org.freedesktop.Telepathy.Error.InvalidHandle", + "VICaR Connection: Failed to create channel: Handle type not supported."); + return QDBusObjectPath(); + } + + if (d->connection_status != Connected) + { + sendErrorReply("org.freedesktop.Telepathy.Error.Disconnected", + "VICaR Connection: Failed to create channel: Connection is Disconnected."); + return QDBusObjectPath(); + } + + //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()); + QString strMessage; + strMessage = "VICaR Connection: CreateChannel"; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + 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()); + QString strMessage = "VICaR Connection: EnsureChannel"; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + qDebug() << " Request details are: "<< request; + + //WARNING: Incomplete implementation + processChannel(request); + + return true; +} + +QDBusObjectPath Connection::processChannel(const QVariantMap &request){ + + QString strMessage = "VICaR Connection: ProcessChannel"; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + + 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; + } + else if (strNumber == "publish" || strNumber == "subscribe"){ + //Deny the persistent Mission control requests to publish and subscribe + QString strError = "VICaR - Invalid request. " + strNumber + " is not supported."; + sendErrorReply("org.freedesktop.Telepathy.Error.InvalidArgument", + strError); + return channel_path; + + } + + //Only allow requests with handle type as contact + QVariant vTargetHandleType = request.value("org.freedesktop.Telepathy.Channel.TargetHandleType"); + uint intTargetHandleType = vTargetHandleType.toUInt(); + if (intTargetHandleType != HandleContact) + { + strMessage = "VICaR - Supports handles of type Contact only. Recieved handle type "; + strMessage.append(vTargetHandleType.toString()); + + sendErrorReply("org.freedesktop.Telepathy.Error.InvalidArgument", + strMessage); + 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); + + strMessage = "VICaR Connection: Call is processed."; + + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + + return channel_path; +} + + +void Connection::AddClientInterest(const QStringList &tokens){ + //WARNING: Incomplete implementation + Q_UNUSED(tokens); + QString strMessage; + + strMessage = "VICaR Connection: AddClientInterest"; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); +} + +void Connection::RemoveClientInterest(const QStringList &tokens){ + //WARNING: Incomplete implementation + Q_UNUSED(tokens); + QString strMessage; + + strMessage = "VICaR Connection: RemoveClientInterest"; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); +} + +//org.freedesktop.Telepathy.Connection.Interface.Capabilities +org::freedesktop::Telepathy::ContactCapabilitiesList Connection::GetCapabilities(const QList &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/cpp/connection.h b/src/vicar-telepathy/cpp/connection.h new file mode 100644 index 0000000..9604683 --- /dev/null +++ b/src/vicar-telepathy/cpp/connection.h @@ -0,0 +1,154 @@ +/* +@version: 0.6 +@author: Sudheer K. +@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 + * + * 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 +#include + +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 RequestHandles(const uint handle_type, const QStringList &names); + void HoldHandles(const uint handle_type, const QList &handles); + QStringList InspectHandles(const uint handle_type, const QList &handles); + void ReleaseHandles(const uint handle_type, const QList &handles); + + org::freedesktop::Telepathy::ChannelInfoList ListChannels(); + QDBusObjectPath RequestChannel(const QString &type, + uint handle_type, uint handle, + bool suppress_handler); + + //New methods added in Telepathy specification 0.21.3 + void AddClientInterest(const QStringList &tokens); + void RemoveClientInterest(const QStringList &tokens); + + + //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 &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); + //New signals added in Telepathy specification 0.17.10 + void SelfHandleChanged(uint handle); + void ConnectionError(const QString & error, QVariantMap errorDetails); + + + //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/cpp/connectionadaptor.cpp b/src/vicar-telepathy/cpp/connectionadaptor.cpp new file mode 100644 index 0000000..f0da7c5 --- /dev/null +++ b/src/vicar-telepathy/cpp/connectionadaptor.cpp @@ -0,0 +1,159 @@ +/* + * This file was generated by qdbusxml2cpp version 0.7 + * Command line was: qdbusxml2cpp -i vicar-telepathy/cpp/connectiontypes.h -c ConnectionAdaptor -a connectionadaptor.h:connectionadaptor.cpp data/xml/org.freedesktop.Telepathy.Connection.xml + * + * qdbusxml2cpp is Copyright (C) 2011 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 "connectionadaptor.h" +#include +#include +#include +#include +#include +#include +#include + +/* + * Implementation of adaptor class ConnectionAdaptor + */ + +ConnectionAdaptor::ConnectionAdaptor(QObject *parent) + : QDBusAbstractAdaptor(parent) +{ + // constructor + setAutoRelaySignals(true); +} + +ConnectionAdaptor::~ConnectionAdaptor() +{ + // destructor +} + +bool ConnectionAdaptor::hasImmortalHandles() const +{ + // get the value of property HasImmortalHandles + return qvariant_cast< bool >(parent()->property("HasImmortalHandles")); +} + +QStringList ConnectionAdaptor::interfaces() const +{ + // get the value of property Interfaces + return qvariant_cast< QStringList >(parent()->property("Interfaces")); +} + +uint ConnectionAdaptor::selfHandle() const +{ + // get the value of property SelfHandle + return qvariant_cast< uint >(parent()->property("SelfHandle")); +} + +uint ConnectionAdaptor::status() const +{ + // get the value of property Status + return qvariant_cast< uint >(parent()->property("Status")); +} + +void ConnectionAdaptor::AddClientInterest(const QStringList &tokens) +{ + // handle method call org.freedesktop.Telepathy.Connection.AddClientInterest + QMetaObject::invokeMethod(parent(), "AddClientInterest", Q_ARG(QStringList, tokens)); +} + +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 &handles) +{ + // handle method call org.freedesktop.Telepathy.Connection.HoldHandles + QMetaObject::invokeMethod(parent(), "HoldHandles", Q_ARG(uint, handle_type), Q_ARG(QList, handles)); +} + +QStringList ConnectionAdaptor::InspectHandles(uint handle_type, const QList &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, 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 &handles) +{ + // handle method call org.freedesktop.Telepathy.Connection.ReleaseHandles + QMetaObject::invokeMethod(parent(), "ReleaseHandles", Q_ARG(uint, handle_type), Q_ARG(QList, handles)); +} + +void ConnectionAdaptor::RemoveClientInterest(const QStringList &tokens) +{ + // handle method call org.freedesktop.Telepathy.Connection.RemoveClientInterest + QMetaObject::invokeMethod(parent(), "RemoveClientInterest", Q_ARG(QStringList, tokens)); +} + +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 ConnectionAdaptor::RequestHandles(uint handle_type, const QStringList &names) +{ + // handle method call org.freedesktop.Telepathy.Connection.RequestHandles + QList out0; + QMetaObject::invokeMethod(parent(), "RequestHandles", Q_RETURN_ARG(QList, out0), Q_ARG(uint, handle_type), Q_ARG(QStringList, names)); + return out0; +} + diff --git a/src/vicar-telepathy/cpp/connectionadaptor.h b/src/vicar-telepathy/cpp/connectionadaptor.h new file mode 100644 index 0000000..8cb7abb --- /dev/null +++ b/src/vicar-telepathy/cpp/connectionadaptor.h @@ -0,0 +1,151 @@ +/* + * This file was generated by qdbusxml2cpp version 0.7 + * Command line was: qdbusxml2cpp -i vicar-telepathy/cpp/connectiontypes.h -c ConnectionAdaptor -a connectionadaptor.h:connectionadaptor.cpp data/xml/org.freedesktop.Telepathy.Connection.xml + * + * qdbusxml2cpp is Copyright (C) 2011 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 CONNECTIONADAPTOR_H_1318911911 +#define CONNECTIONADAPTOR_H_1318911911 + +#include +#include +#include "connectiontypes.h" +class QByteArray; +template class QList; +template 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", "" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \" name=\"com.trolltech.QtDBus.QtTypeName.In1\"/>\n" +" \n" +" \n" +" \n" +" \n" +" \" name=\"com.trolltech.QtDBus.QtTypeName.In1\"/>\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \" name=\"com.trolltech.QtDBus.QtTypeName.In1\"/>\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \" name=\"com.trolltech.QtDBus.QtTypeName.Out0\"/>\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" + "") +public: + ConnectionAdaptor(QObject *parent); + virtual ~ConnectionAdaptor(); + +public: // PROPERTIES + Q_PROPERTY(bool HasImmortalHandles READ hasImmortalHandles) + bool hasImmortalHandles() const; + + Q_PROPERTY(QStringList Interfaces READ interfaces) + QStringList interfaces() const; + + Q_PROPERTY(uint SelfHandle READ selfHandle) + uint selfHandle() const; + + Q_PROPERTY(uint Status READ status) + uint status() const; + +public Q_SLOTS: // METHODS + void AddClientInterest(const QStringList &tokens); + void Connect(); + void Disconnect(); + QStringList GetInterfaces(); + QString GetProtocol(); + uint GetSelfHandle(); + uint GetStatus(); + void HoldHandles(uint handle_type, const QList &handles); + QStringList InspectHandles(uint handle_type, const QList &handles); + org::freedesktop::Telepathy::ChannelInfoList ListChannels(); + void ReleaseHandles(uint handle_type, const QList &handles); + void RemoveClientInterest(const QStringList &tokens); + QDBusObjectPath RequestChannel(const QString &type, uint handle_type, uint handle, bool suppress_handler); + QList RequestHandles(uint handle_type, const QStringList &names); +Q_SIGNALS: // SIGNALS + void ConnectionError(const QString &error, const QVariantMap &error_details); + void NewChannel(const QDBusObjectPath &object_path, const QString &channel_type, uint handle_type, uint handle, bool suppress_handler); + void SelfHandleChanged(uint in0); + void StatusChanged(uint status, uint reason); +}; + +#endif diff --git a/src/vicar-telepathy/cpp/connectioninterfacecapabilitiesadaptor.cpp b/src/vicar-telepathy/cpp/connectioninterfacecapabilitiesadaptor.cpp new file mode 100644 index 0000000..7cb1780 --- /dev/null +++ b/src/vicar-telepathy/cpp/connectioninterfacecapabilitiesadaptor.cpp @@ -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 +#include +#include +#include +#include +#include +#include + +/* + * 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 &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, Handles)); + return Contact_Capabilities; +} + diff --git a/src/vicar-telepathy/cpp/connectioninterfacecapabilitiesadaptor.h b/src/vicar-telepathy/cpp/connectioninterfacecapabilitiesadaptor.h new file mode 100644 index 0000000..c891276 --- /dev/null +++ b/src/vicar-telepathy/cpp/connectioninterfacecapabilitiesadaptor.h @@ -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 +#include +#include "connectioninterfacecapabilitiestypes.h" +class QByteArray; +template class QList; +template 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", "" +" \n" +" \n" +" \" name=\"com.trolltech.QtDBus.QtTypeName.In0\"/>\n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \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 &Handles); +Q_SIGNALS: // SIGNALS + void CapabilitiesChanged(org::freedesktop::Telepathy::CapabilityChangeList in0); +}; + +#endif diff --git a/src/vicar-telepathy/cpp/connectioninterfacecapabilitiestypes.cpp b/src/vicar-telepathy/cpp/connectioninterfacecapabilitiestypes.cpp new file mode 100644 index 0000000..edcfe08 --- /dev/null +++ b/src/vicar-telepathy/cpp/connectioninterfacecapabilitiestypes.cpp @@ -0,0 +1,98 @@ +/* +@version: 0.6 +@author: Sudheer K. +@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 + * + * 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/cpp/connectioninterfacecapabilitiestypes.h b/src/vicar-telepathy/cpp/connectioninterfacecapabilitiestypes.h new file mode 100644 index 0000000..d104ffe --- /dev/null +++ b/src/vicar-telepathy/cpp/connectioninterfacecapabilitiestypes.h @@ -0,0 +1,98 @@ +/* +@version: 0.6 +@author: Sudheer K. +@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 + * Copyright (C) 2006 by INdT + * @author Andre Moreira Magalhaes + * + * 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 +#include +#include +#include +#include + +namespace org { +namespace freedesktop { +namespace Telepathy { + +class ContactCapabilities +{ +public: + uint handle; + QString channelType; + uint genericCapabilityFlags; + uint typeSpecificFlags; +}; +typedef QList ContactCapabilitiesList; + +class CapabilityPair +{ +public: + QString channelType; + uint typeSpecificFlags; +}; +typedef QList CapabilityPairList; + +class CapabilityChange +{ +public: + uint handle; + QString channelType; + uint oldGenericFlags; + uint newGenericFlags; + uint oldTypeSpecificFlags; + uint newTypeSpecificFlags; +}; +typedef QList 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/cpp/connectioninterfacerequestsadaptor.cpp b/src/vicar-telepathy/cpp/connectioninterfacerequestsadaptor.cpp new file mode 100644 index 0000000..3742f93 --- /dev/null +++ b/src/vicar-telepathy/cpp/connectioninterfacerequestsadaptor.cpp @@ -0,0 +1,59 @@ +/* + * This file was generated by qdbusxml2cpp version 0.7 + * Command line was: qdbusxml2cpp -i vicar-telepathy/cpp/connectioninterfacerequeststypes.h -c ConnectionInterfaceRequestsAdaptor -a connectioninterfacerequestsadaptor.h:connectioninterfacerequestsadaptor.cpp data/xml/org.freedesktop.Telepathy.Connection.I.Requests.xml + * + * qdbusxml2cpp is Copyright (C) 2011 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 +#include +#include +#include +#include +#include +#include + +/* + * Implementation of adaptor class ConnectionInterfaceRequestsAdaptor + */ + +ConnectionInterfaceRequestsAdaptor::ConnectionInterfaceRequestsAdaptor(QObject *parent) + : QDBusAbstractAdaptor(parent) +{ + // constructor + setAutoRelaySignals(true); +} + +ConnectionInterfaceRequestsAdaptor::~ConnectionInterfaceRequestsAdaptor() +{ + // destructor +} + +org::freedesktop::Telepathy::ChannelDetailsList ConnectionInterfaceRequestsAdaptor::channels() const +{ + // get the value of property Channels + return qvariant_cast< org::freedesktop::Telepathy::ChannelDetailsList >(parent()->property("Channels")); +} + +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(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(parent())->EnsureChannel(request, channel_object, channel_properties); +} + diff --git a/src/vicar-telepathy/cpp/connectioninterfacerequestsadaptor.h b/src/vicar-telepathy/cpp/connectioninterfacerequestsadaptor.h new file mode 100644 index 0000000..7eb1a32 --- /dev/null +++ b/src/vicar-telepathy/cpp/connectioninterfacerequestsadaptor.h @@ -0,0 +1,83 @@ +/* + * This file was generated by qdbusxml2cpp version 0.7 + * Command line was: qdbusxml2cpp -i vicar-telepathy/cpp/connectioninterfacerequeststypes.h -c ConnectionInterfaceRequestsAdaptor -a connectioninterfacerequestsadaptor.h:connectioninterfacerequestsadaptor.cpp data/xml/org.freedesktop.Telepathy.Connection.I.Requests.xml + * + * qdbusxml2cpp is Copyright (C) 2011 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_1318919889 +#define CONNECTIONINTERFACEREQUESTSADAPTOR_H_1318919889 + +#include +#include +#include "connectioninterfacerequeststypes.h" +class QByteArray; +template class QList; +template 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", "" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" + "") +public: + ConnectionInterfaceRequestsAdaptor(QObject *parent); + virtual ~ConnectionInterfaceRequestsAdaptor(); + +public: // PROPERTIES + Q_PROPERTY(org::freedesktop::Telepathy::ChannelDetailsList Channels READ channels) + org::freedesktop::Telepathy::ChannelDetailsList channels() const; + + 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/cpp/connectioninterfacerequeststypes.cpp b/src/vicar-telepathy/cpp/connectioninterfacerequeststypes.cpp new file mode 100644 index 0000000..d0546a5 --- /dev/null +++ b/src/vicar-telepathy/cpp/connectioninterfacerequeststypes.cpp @@ -0,0 +1,75 @@ +/* +@version: 0.6 +@author: Sudheer K. +@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 + * + * 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/cpp/connectioninterfacerequeststypes.h b/src/vicar-telepathy/cpp/connectioninterfacerequeststypes.h new file mode 100644 index 0000000..8f1fab9 --- /dev/null +++ b/src/vicar-telepathy/cpp/connectioninterfacerequeststypes.h @@ -0,0 +1,78 @@ +/* +@version: 0.6 +@author: Sudheer K. +@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 + * Copyright (C) 2006 by INdT + * @author Andre Moreira Magalhaes + * + * 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 +#include +#include +#include +#include + +namespace org { +namespace freedesktop { +namespace Telepathy { + +class ChannelDetails +{ +public: + QDBusObjectPath channel; + QVariantMap properties; +}; +typedef QList ChannelDetailsList; + +class RequestableChannelClass +{ +public: + QVariantMap fixedProperties; + QStringList allowedProperties; +}; +typedef QList 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/cpp/connectionmanager.cpp b/src/vicar-telepathy/cpp/connectionmanager.cpp new file mode 100644 index 0000000..b4495f0 --- /dev/null +++ b/src/vicar-telepathy/cpp/connectionmanager.cpp @@ -0,0 +1,236 @@ +/* +@version: 0.6 +@author: Sudheer K. +@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 + * + * 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 + +#include + +namespace +{ +static const QString protocol_name("tel"); +} + +class ConnectionManagerPrivate +{ +public: + ConnectionManagerPrivate(ConnectionManager * parent) : + adaptor(new ConnectionManagerAdaptor(parent)), + logUtility(new LogUtility("/var/log/vicar/vicar.log",parent)) + { + Q_ASSERT(0 != adaptor); + activeConnection = 0; + } + + ~ConnectionManagerPrivate() { delete(adaptor);} + ConnectionManagerAdaptor * const adaptor; + LogUtility * const logUtility; + Connection * activeConnection; +}; + +// --------------------------------------------------------------------------- + +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) +{ + + QString strMessage; + Q_ASSERT(!proto.isEmpty()); + Q_UNUSED(proto); + strMessage = "VICAR: ConnectionManager::GetParameters(const QString &prot)"; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + org::freedesktop::Telepathy::ParameterDefinitionList result; + org::freedesktop::Telepathy::ParameterDefinition param; + + //TODO - Match the parameters with telepathy-ring? + + // 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() +{ + QString strMessage = "VICaR ConnectionManager::ListProtocols()"; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + return QStringList(protocol_name); +} + +QString ConnectionManager::RequestConnection(const QString & proto, + QVariantMap parameters, + QDBusObjectPath & object_path) +{ + QString strMessage = "VICaR CM: Connection Requested for protocol "+proto; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + 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."); + */ + strMessage = "VICaR CM::RequestConnection: proto mismatch."; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + return connection_service; + } + if (d->activeConnection != 0){ + strMessage = "VICaR CM::RequestConnection: An active connection already exists at "+d->activeConnection->serviceName(); + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + + object_path = d->activeConnection->objectPath(); + connection_service = d->activeConnection->serviceName(); + //emit NewConnection(connection_service, object_path, "tel"); //Just in case, emit the NewConnection again + 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."); + */ + strMessage = "VICaR CM::RequestConnection: invalid parameter" + param + "found."; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + return connection_service; + } + } + + strMessage = "DEBUG CM: Trying to create new connection with account "+account; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + + Connection * new_connection = new Connection(account, this); + Q_ASSERT(0 != new_connection); + + strMessage = "DEBUG CM: Trying to register new connection"; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + + if (!new_connection->registerObject()) + { + strMessage = "VICaR CM: Error while registering Connection object with DBus."; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + new_connection->deleteLater(); + return QString(); + } + + strMessage = "VICaR CM: New Connection Created. Status is " + QString(new_connection->GetStatus()); + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + + + object_path = new_connection->objectPath(); + connection_service = new_connection->serviceName(); + + strMessage = "VICaR CM: Emitting New Connection Signal"; + qDebug() << strMessage; + d->logUtility->logMessage(strMessage); + + emit NewConnection(connection_service, object_path, "tel"); + + //Set ActiveConnection - We only need one active connection at a time + d->activeConnection = new_connection; + return new_connection->serviceName(); +} diff --git a/src/vicar-telepathy/cpp/connectionmanager.h b/src/vicar-telepathy/cpp/connectionmanager.h new file mode 100644 index 0000000..789aab6 --- /dev/null +++ b/src/vicar-telepathy/cpp/connectionmanager.h @@ -0,0 +1,75 @@ +/* +@version: 0.6 +@author: Sudheer K. +@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 + * + * 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 +#include + +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/cpp/connectionmanageradaptor.cpp b/src/vicar-telepathy/cpp/connectionmanageradaptor.cpp new file mode 100644 index 0000000..d652985 --- /dev/null +++ b/src/vicar-telepathy/cpp/connectionmanageradaptor.cpp @@ -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 +#include +#include +#include +#include +#include +#include +#include + +#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(parent())->RequestConnection(proto, parameters, object_path); +} + diff --git a/src/vicar-telepathy/cpp/connectionmanageradaptor.h b/src/vicar-telepathy/cpp/connectionmanageradaptor.h new file mode 100644 index 0000000..9d06b28 --- /dev/null +++ b/src/vicar-telepathy/cpp/connectionmanageradaptor.h @@ -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 +#include +#include "connectionmanagertypes.h" +class QByteArray; +template class QList; +template 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", "" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \n" +" \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/cpp/connectionmanagertypes.cpp b/src/vicar-telepathy/cpp/connectionmanagertypes.cpp new file mode 100644 index 0000000..7777941 --- /dev/null +++ b/src/vicar-telepathy/cpp/connectionmanagertypes.cpp @@ -0,0 +1,48 @@ +/* +@version: 0.6 +@author: Sudheer K. +@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 + * + * 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 ¶m) +{ + argument.beginStructure(); + argument >> param.name >> param.flags >> param.signature >> param.defaultValue; + argument.endStructure(); + return argument; +} + +QDBusArgument &operator<<(QDBusArgument &argument, const ParameterDefinition ¶m) +{ + argument.beginStructure(); + argument << param.name << param.flags << param.signature << param.defaultValue; + argument.endStructure(); + return argument; +} + diff --git a/src/vicar-telepathy/cpp/connectionmanagertypes.h b/src/vicar-telepathy/cpp/connectionmanagertypes.h new file mode 100644 index 0000000..88764bc --- /dev/null +++ b/src/vicar-telepathy/cpp/connectionmanagertypes.h @@ -0,0 +1,64 @@ +/* +@version: 0.6 +@author: Sudheer K. +@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 + * Copyright (C) 2006 by INdT + * @author Andre Moreira Magalhaes + * + * 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 +#include +#include +#include +#include + +namespace org { +namespace freedesktop { +namespace Telepathy { + +class ParameterDefinition +{ +public: + QString name; + uint flags; + QString signature; + QDBusVariant defaultValue; +}; +typedef QList 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 ¶m); +QDBusArgument &operator<<(QDBusArgument &argument, const org::freedesktop::Telepathy::ParameterDefinition ¶m); + +#endif + diff --git a/src/vicar-telepathy/cpp/connectiontypes.cpp b/src/vicar-telepathy/cpp/connectiontypes.cpp new file mode 100644 index 0000000..4e90932 --- /dev/null +++ b/src/vicar-telepathy/cpp/connectiontypes.cpp @@ -0,0 +1,48 @@ +/* +@version: 0.6 +@author: Sudheer K. +@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 + * + * 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/cpp/connectiontypes.h b/src/vicar-telepathy/cpp/connectiontypes.h new file mode 100644 index 0000000..854544f --- /dev/null +++ b/src/vicar-telepathy/cpp/connectiontypes.h @@ -0,0 +1,93 @@ +/* +@version: 0.6 +@author: Sudheer K. +@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 + * Copyright (C) 2006 by INdT + * @author Andre Moreira Magalhaes + * + * 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 +#include +#include +#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 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/cpp/main.cpp b/src/vicar-telepathy/cpp/main.cpp new file mode 100644 index 0000000..b6024ca --- /dev/null +++ b/src/vicar-telepathy/cpp/main.cpp @@ -0,0 +1,130 @@ +/* +@version: 0.6 +@author: Sudheer K. +@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 + * + * 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 +#include + +#include +#include + +#include +#include +#include +#include +#include + +#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(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + + QDBusConnection connection = QDBusConnection::sessionBus(); + + if (!connection.interface()->isServiceRegistered(cm_service_name)) + { + + // register CM on D-BUS: + bool success = connection.registerService(cm_service_name); + if (success){ + qDebug(qPrintable(QObject::tr("Vicar-Telepathy: Service %1 registered with session bus."). + arg(cm_service_name))); + } + else{ + + QDBusError error = connection.interface()->lastError(); + + qDebug(qPrintable(QObject::tr("Vicar-Telepathy: Unable to register service %1 with session bus due to error %2."). + arg(cm_service_name,error.message()))); + } + + } + + ConnectionManager connection_mgr(&app); + if (!connection.registerObject(cm_object_path,&connection_mgr)){ + qDebug(qPrintable(QObject::tr("Vicar-Telepathy: Unable to register VICaR connection manager at path %1 with session bus."). + arg(cm_object_path))); + } + + qDebug(qPrintable(QObject::tr("Vicar-Telepathy: Enternig main loop."))); + return app.exec(); +} diff --git a/src/vicar-telepathy/cpp/names.h b/src/vicar-telepathy/cpp/names.h new file mode 100644 index 0000000..8e2c141 --- /dev/null +++ b/src/vicar-telepathy/cpp/names.h @@ -0,0 +1,48 @@ +/* +@version: 0.6 +@author: Sudheer K. +@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 + * + * 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/cpp/vicarcallrouterproxy.cpp b/src/vicar-telepathy/cpp/vicarcallrouterproxy.cpp new file mode 100644 index 0000000..7bd1be3 --- /dev/null +++ b/src/vicar-telepathy/cpp/vicarcallrouterproxy.cpp @@ -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/cpp/vicarcallrouterproxy.h b/src/vicar-telepathy/cpp/vicarcallrouterproxy.h new file mode 100644 index 0000000..d0fa3e3 --- /dev/null +++ b/src/vicar-telepathy/cpp/vicarcallrouterproxy.h @@ -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 +#include +#include +#include +#include +#include +#include +#include + +/* + * 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 callInternationalNumber(const QString &number) + { + QList argumentList; + argumentList << qVariantFromValue(number); + return asyncCallWithArgumentList(QLatin1String("callInternationalNumber"), argumentList); + } + + inline QDBusPendingReply isRunning() + { + QList argumentList; + return asyncCallWithArgumentList(QLatin1String("isRunning"), argumentList); + } + + inline QDBusPendingReply startOutgoingCallMonitor() + { + QList argumentList; + return asyncCallWithArgumentList(QLatin1String("startOutgoingCallMonitor"), argumentList); + } + + inline QDBusPendingReply stopOutgoingCallMonitor() + { + QList argumentList; + return asyncCallWithArgumentList(QLatin1String("stopOutgoingCallMonitor"), argumentList); + } + +Q_SIGNALS: // SIGNALS +}; + +namespace org { + namespace maemo { + typedef ::VicarCallRouterProxy vicar; + } +} +#endif diff --git a/src/vicar-telepathy/src/basetypes.h b/src/vicar-telepathy/src/basetypes.h deleted file mode 100644 index 28ddabd..0000000 --- a/src/vicar-telepathy/src/basetypes.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * QtTelepathy, the Tapioca Qt4 Telepathy Client Library - * Copyright (C) 2006 by Tobias Hunger - * Copyright (C) 2006 by INdT - * @author Andre Moreira Magalhaes - * - * 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 -#include -#include -#include -#include - -Q_DECLARE_METATYPE(QList) -Q_DECLARE_METATYPE(QVariantMap) - -#endif - diff --git a/src/vicar-telepathy/src/connection.cpp b/src/vicar-telepathy/src/connection.cpp deleted file mode 100644 index c45810d..0000000 --- a/src/vicar-telepathy/src/connection.cpp +++ /dev/null @@ -1,502 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@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 - * - * 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 -#include -#include -#include -#include - - -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 <(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 Connection::RequestHandles(uint handle_type, - const QStringList & names) -{ - Q_UNUSED(names); - QList 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 &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 &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 &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; - } - else if (strNumber == "publish" || strNumber == "subscribe"){ - //Deny the persistent Mission control requests to publish and subscribe - QString strError = "VICaR - Invalid request. " + strNumber + " is not supported."; - sendErrorReply("org.freedesktop.Telepathy.Error.InvalidArgument", - strError); - return channel_path; - - } - - //Only allow requests with handle type as contact - QVariant vTargetHandleType = request.value("org.freedesktop.Telepathy.Channel.TargetHandleType"); - uint intTargetHandleType = vTargetHandleType.toUInt(); - if (intTargetHandleType != HandleContact) - { - QString strMessage = "VICaR - Supports handles of type Contact only. Recieved handle type "; - strMessage.append(vTargetHandleType.toString()); - - sendErrorReply("org.freedesktop.Telepathy.Error.InvalidArgument", - strMessage); - 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 &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 deleted file mode 100644 index 5ec7df0..0000000 --- a/src/vicar-telepathy/src/connection.h +++ /dev/null @@ -1,145 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@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 - * - * 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 -#include - -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 RequestHandles(const uint handle_type, const QStringList &names); - void HoldHandles(const uint handle_type, const QList &handles); - QStringList InspectHandles(const uint handle_type, const QList &handles); - void ReleaseHandles(const uint handle_type, const QList &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 &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 deleted file mode 100644 index 09ef293..0000000 --- a/src/vicar-telepathy/src/connectionadaptor.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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 -#include -#include -#include -#include -#include -#include -#include - -/* - * 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 &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, handles)); -} - -QStringList ConnectionAdaptor::InspectHandles(uint handle_type, const QList &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, 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 &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, 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 ConnectionAdaptor::RequestHandles(uint handle_type, const QStringList &names) -{ - // handle method call org.freedesktop.Telepathy.Connection.RequestHandles - QList out0; - QMetaObject::invokeMethod(parent(), "RequestHandles", Q_RETURN_ARG(QList, 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 deleted file mode 100644 index 5b9a012..0000000 --- a/src/vicar-telepathy/src/connectionadaptor.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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 -#include -#include "connectiontypes.h" -class QByteArray; -template class QList; -template 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", "" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \" name=\"com.trolltech.QtDBus.QtTypeName.In1\" />\n" -" \n" -" \n" -" \n" -" \n" -" \" name=\"com.trolltech.QtDBus.QtTypeName.In1\" />\n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \" name=\"com.trolltech.QtDBus.QtTypeName.In1\" />\n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \" name=\"com.trolltech.QtDBus.QtTypeName.Out0\" />\n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \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 &handles); - QStringList InspectHandles(uint handle_type, const QList &handles); - org::freedesktop::Telepathy::ChannelInfoList ListChannels(); - void ReleaseHandles(uint handle_type, const QList &handles); - QDBusObjectPath RequestChannel(const QString &type, uint handle_type, uint handle, bool suppress_handler); - QList 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 deleted file mode 100644 index 7cb1780..0000000 --- a/src/vicar-telepathy/src/connectioninterfacecapabilitiesadaptor.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 -#include -#include -#include -#include -#include -#include - -/* - * 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 &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, Handles)); - return Contact_Capabilities; -} - diff --git a/src/vicar-telepathy/src/connectioninterfacecapabilitiesadaptor.h b/src/vicar-telepathy/src/connectioninterfacecapabilitiesadaptor.h deleted file mode 100644 index c891276..0000000 --- a/src/vicar-telepathy/src/connectioninterfacecapabilitiesadaptor.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 -#include -#include "connectioninterfacecapabilitiestypes.h" -class QByteArray; -template class QList; -template 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", "" -" \n" -" \n" -" \" name=\"com.trolltech.QtDBus.QtTypeName.In0\"/>\n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \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 &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 deleted file mode 100644 index edcfe08..0000000 --- a/src/vicar-telepathy/src/connectioninterfacecapabilitiestypes.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@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 - * - * 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 deleted file mode 100644 index d104ffe..0000000 --- a/src/vicar-telepathy/src/connectioninterfacecapabilitiestypes.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@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 - * Copyright (C) 2006 by INdT - * @author Andre Moreira Magalhaes - * - * 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 -#include -#include -#include -#include - -namespace org { -namespace freedesktop { -namespace Telepathy { - -class ContactCapabilities -{ -public: - uint handle; - QString channelType; - uint genericCapabilityFlags; - uint typeSpecificFlags; -}; -typedef QList ContactCapabilitiesList; - -class CapabilityPair -{ -public: - QString channelType; - uint typeSpecificFlags; -}; -typedef QList CapabilityPairList; - -class CapabilityChange -{ -public: - uint handle; - QString channelType; - uint oldGenericFlags; - uint newGenericFlags; - uint oldTypeSpecificFlags; - uint newTypeSpecificFlags; -}; -typedef QList 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 deleted file mode 100644 index 6f4459c..0000000 --- a/src/vicar-telepathy/src/connectioninterfacerequestsadaptor.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 -#include -#include -#include -#include -#include -#include - -/* - * 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(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(parent())->EnsureChannel(request, channel_object, channel_properties); -} - diff --git a/src/vicar-telepathy/src/connectioninterfacerequestsadaptor.h b/src/vicar-telepathy/src/connectioninterfacerequestsadaptor.h deleted file mode 100644 index 527e7f8..0000000 --- a/src/vicar-telepathy/src/connectioninterfacerequestsadaptor.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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 -#include -#include "connectioninterfacerequeststypes.h" -class QByteArray; -template class QList; -template 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", "" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \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 deleted file mode 100644 index d0546a5..0000000 --- a/src/vicar-telepathy/src/connectioninterfacerequeststypes.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@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 - * - * 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 deleted file mode 100644 index 8f1fab9..0000000 --- a/src/vicar-telepathy/src/connectioninterfacerequeststypes.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@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 - * Copyright (C) 2006 by INdT - * @author Andre Moreira Magalhaes - * - * 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 -#include -#include -#include -#include - -namespace org { -namespace freedesktop { -namespace Telepathy { - -class ChannelDetails -{ -public: - QDBusObjectPath channel; - QVariantMap properties; -}; -typedef QList ChannelDetailsList; - -class RequestableChannelClass -{ -public: - QVariantMap fixedProperties; - QStringList allowedProperties; -}; -typedef QList 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 deleted file mode 100644 index 635fa76..0000000 --- a/src/vicar-telepathy/src/connectionmanager.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@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 - * - * 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 - -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 deleted file mode 100644 index 789aab6..0000000 --- a/src/vicar-telepathy/src/connectionmanager.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@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 - * - * 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 -#include - -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 deleted file mode 100644 index d652985..0000000 --- a/src/vicar-telepathy/src/connectionmanageradaptor.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 -#include -#include -#include -#include -#include -#include -#include - -#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(parent())->RequestConnection(proto, parameters, object_path); -} - diff --git a/src/vicar-telepathy/src/connectionmanageradaptor.h b/src/vicar-telepathy/src/connectionmanageradaptor.h deleted file mode 100644 index 9d06b28..0000000 --- a/src/vicar-telepathy/src/connectionmanageradaptor.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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 -#include -#include "connectionmanagertypes.h" -class QByteArray; -template class QList; -template 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", "" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \n" -" \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 deleted file mode 100644 index 7777941..0000000 --- a/src/vicar-telepathy/src/connectionmanagertypes.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@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 - * - * 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 ¶m) -{ - argument.beginStructure(); - argument >> param.name >> param.flags >> param.signature >> param.defaultValue; - argument.endStructure(); - return argument; -} - -QDBusArgument &operator<<(QDBusArgument &argument, const ParameterDefinition ¶m) -{ - 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 deleted file mode 100644 index 88764bc..0000000 --- a/src/vicar-telepathy/src/connectionmanagertypes.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@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 - * Copyright (C) 2006 by INdT - * @author Andre Moreira Magalhaes - * - * 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 -#include -#include -#include -#include - -namespace org { -namespace freedesktop { -namespace Telepathy { - -class ParameterDefinition -{ -public: - QString name; - uint flags; - QString signature; - QDBusVariant defaultValue; -}; -typedef QList 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 ¶m); -QDBusArgument &operator<<(QDBusArgument &argument, const org::freedesktop::Telepathy::ParameterDefinition ¶m); - -#endif - diff --git a/src/vicar-telepathy/src/connectiontypes.cpp b/src/vicar-telepathy/src/connectiontypes.cpp deleted file mode 100644 index 4e90932..0000000 --- a/src/vicar-telepathy/src/connectiontypes.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@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 - * - * 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 deleted file mode 100644 index 854544f..0000000 --- a/src/vicar-telepathy/src/connectiontypes.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@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 - * Copyright (C) 2006 by INdT - * @author Andre Moreira Magalhaes - * - * 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 -#include -#include -#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 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 deleted file mode 100644 index a1d59de..0000000 --- a/src/vicar-telepathy/src/main.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@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 - * - * 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 -#include - -#include -#include - -#include -#include -#include -#include - -#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(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - - 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("Vicar-Telepathy: Service %1 registered with session bus."). - arg(cm_service_name))); - } - else{ - qDebug(qPrintable(QObject::tr("Vicar-Telepathy: 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("Vicar-Telepathy: Unable to register VICaR connection manager at path %1 with session bus."). - arg(cm_object_path))); - } - - qDebug(qPrintable(QObject::tr("Vicar-Telepathy: Enternig main loop."))); -// logfile.close(); - return app.exec(); -} diff --git a/src/vicar-telepathy/src/names.h b/src/vicar-telepathy/src/names.h deleted file mode 100644 index 8e2c141..0000000 --- a/src/vicar-telepathy/src/names.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@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 - * - * 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 deleted file mode 100644 index 7bd1be3..0000000 --- a/src/vicar-telepathy/src/vicarcallrouterproxy.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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 deleted file mode 100644 index d0fa3e3..0000000 --- a/src/vicar-telepathy/src/vicarcallrouterproxy.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 -#include -#include -#include -#include -#include -#include -#include - -/* - * 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 callInternationalNumber(const QString &number) - { - QList argumentList; - argumentList << qVariantFromValue(number); - return asyncCallWithArgumentList(QLatin1String("callInternationalNumber"), argumentList); - } - - inline QDBusPendingReply isRunning() - { - QList argumentList; - return asyncCallWithArgumentList(QLatin1String("isRunning"), argumentList); - } - - inline QDBusPendingReply startOutgoingCallMonitor() - { - QList argumentList; - return asyncCallWithArgumentList(QLatin1String("startOutgoingCallMonitor"), argumentList); - } - - inline QDBusPendingReply stopOutgoingCallMonitor() - { - QList 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 index 2522ef7..08b0fef 100644 --- a/src/vicar-telepathy/vicar-telepathy.pro +++ b/src/vicar-telepathy/vicar-telepathy.pro @@ -1,56 +1,53 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2010-06-22T19:17:05 -# -#------------------------------------------------- - #INCLUDEPATH += /usr/include/telepathy-1.0 #LIBS += /usr/lib/libtelepathy-qt4.so +exists($$QMAKE_INCDIR_QT"/../qmsystem2/qmkeys.h"){ + DEFINES += Q_WS_MAEMO_6 +} + QT += dbus core QT -= gui TARGET = vicar-telepathy -CONFIG += qt debug console +CONFIG += qt console CONFIG -= app_bundle +INCLUDEPATH += ../vicar-lib/cpp +LIBS += ../lib/libvicar.a + 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 +VPATH += cpp +MOC_DIR = cpp/.mocs +OBJECTS_DIR = cpp/.objs +SOURCES += cpp/main.cpp \ + cpp/connectiontypes.cpp \ + cpp/connectionmanagertypes.cpp \ + cpp/connectionmanageradaptor.cpp \ + cpp/connectionmanager.cpp \ + cpp/connectionadaptor.cpp \ + cpp/connection.cpp \ + cpp/connectioninterfacerequeststypes.cpp \ + cpp/connectioninterfacerequestsadaptor.cpp \ + cpp/vicarcallrouterproxy.cpp \ + cpp/connectioninterfacecapabilitiestypes.cpp \ + cpp/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 + cpp/names.h \ + cpp/connectiontypes.h \ + cpp/connectionmanagertypes.h \ + cpp/connectionmanageradaptor.h \ + cpp/connectionmanager.h \ + cpp/connectionadaptor.h \ + cpp/connection.h \ + cpp/basetypes.h \ + cpp/connectioninterfacerequeststypes.h \ + cpp/connectioninterfacerequestsadaptor.h \ + cpp/vicarcallrouterproxy.h \ + cpp/connectioninterfacecapabilitiestypes.h \ + cpp/connectioninterfacecapabilitiesadaptor.h INSTALLS += target - -target.path =$$INSTALLDIR/opt/vicar +target.path =/opt/vicar/bin diff --git a/src/vicar-utils/cpp/main.cpp b/src/vicar-utils/cpp/main.cpp new file mode 100755 index 0000000..a5a19da --- /dev/null +++ b/src/vicar-utils/cpp/main.cpp @@ -0,0 +1,152 @@ +/* +@version: 0.6 +@author: Sudheer K. +@license: GNU General Public License +*/ + +#include "telepathyutility.h" +#include "databaseutility.h" +#include "vicarprofiletypes.h" +#include "connectioninterfacerequeststypes.h" +#include "harmattanaccountutility.h" +#include +#include //DEBUG - Delete this +#include "dbusutility.h" +#include +#include + +int main(int argc, char *argv[]) +{ + + QCoreApplication app(argc,argv); + + qDBusRegisterMetaType(); + //From Connection Interface Requests + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + qDBusRegisterMetaType(); + //From Vicar Profile Types + //qDBusRegisterMetaType(); + //qDBusRegisterMetaType(); + + TelepathyUtility *tpUtility = new TelepathyUtility(); + DatabaseUtility *databaseUtility = new DatabaseUtility(); + HarmattanAccountUtility *accountUtility = new HarmattanAccountUtility(); + + 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. " + <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. " + <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. " + <lastError(); + exit(5); + } + qDebug() << "VICaR profiles database deleted."; + } + else if (instruction == "TPACCOUNTSTATUS"){ + QString status = tpUtility->getAccountStatus(); + qDebug() << "Account Status is "<< status; + } + else if (instruction == "--create-account"){ +#if defined(Q_WS_MAEMO_6) + qDebug() << "Creating account"; + accountUtility->addAccount(); +#else + qDebug() << "This command is applicable only in harmattan"; +#endif + } + else if (instruction == "--delete-account"){ +#if defined(Q_WS_MAEMO_6) + qDebug() << "Deleting account"; + accountUtility->removeAccount(); +#else + qDebug() << "This command is applicable only in harmattan"; +#endif + } + else if (instruction == "TESTING"){ + tpUtility->callNumberWithRing(argv[2]); + } + } + else{ + + qDebug() << "Sending Introspect method call"; + + DbusUtility dbusUtility(&app); + QList argsToSend; + + + bool success = dbusUtility.sendMethodCall("org.freedesktop.Telepathy.Connection.ring.tel.ring", + "/org/freedesktop/Telepathy/Connection/ring/tel/ring", + "org.freedesktop.DBus.Introspectable", + "Introspect",argsToSend,false); + + success = dbusUtility.sendMethodCall("org.freedesktop.Telepathy.ConnectionManager.ring", + "/org/freedesktop/Telepathy/ConnectionManager/ring", + "org.freedesktop.DBus.Introspectable", + "Introspect",argsToSend,false); + + /* + + bool success = dbusUtility.sendMethodCall("org.freedesktop.Telepathy.AccountManager", + "/org/freedesktop/Telepathy/Account/ring/tel/ring", + "org.freedesktop.Telepathy.Account", + "Reconnect",argsToSend,false); + */ + + if (!success){ + qDebug() << dbusUtility.getErrorMessage(); + } + else{ + qDebug() << "Method call executed successfully"; + } + app.exec(); + } + + delete (tpUtility); + delete (databaseUtility); + delete (accountUtility); + tpUtility = 0; + databaseUtility = 0; + accountUtility = 0; +} diff --git a/src/vicar-utils/src/main.cpp b/src/vicar-utils/src/main.cpp deleted file mode 100755 index 6bf01a7..0000000 --- a/src/vicar-utils/src/main.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* -@version: 0.6 -@author: Sudheer K. -@license: GNU General Public License -*/ - -#include "telepathyutility.h" -#include "databaseutility.h" -#include "vicarprofiletypes.h" -#include "connectioninterfacerequeststypes.h" -#include -#include - -int main(int argc, char *argv[]) -{ - qDBusRegisterMetaType(); - //From Connection Interface Requests - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - //From Vicar Profile Types - //qDBusRegisterMetaType(); - //qDBusRegisterMetaType(); - - 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. " - <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. " - <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. " - <lastError(); - exit(5); - } - qDebug() << "VICaR profiles database deleted."; - } - else if (instruction == "ACCOUNTSTATUS"){ - QString status = tpUtility->getAccountStatus(); - qDebug() << "Account Status is "<< status; - } - else if (instruction == "TESTING"){ - tpUtility->callNumberWithRing(argv[2]); - } - } - - delete (tpUtility); - delete (databaseUtility); - tpUtility = 0; - databaseUtility = 0; -} diff --git a/src/vicar-utils/vicar-utils.pro b/src/vicar-utils/vicar-utils.pro index 0764089..fbc31d3 100755 --- a/src/vicar-utils/vicar-utils.pro +++ b/src/vicar-utils/vicar-utils.pro @@ -1,4 +1,11 @@ -CONFIG += qt debug +contains(MEEGO_EDITION,harmattan){ + DEFINES += Q_WS_MAEMO_6 + + CONFIG += link_pkgconfig + PKGCONFIG += accounts-qt +} + +CONFIG += core qt debug xml QT += dbus sql QT -= gui TEMPLATE = app @@ -6,19 +13,14 @@ TARGET = vicar-utils CONFIG += console CONFIG -= app_bundle -INCLUDEPATH += ../vicar-lib/src +INCLUDEPATH += ../vicar-lib/cpp LIBS += ../lib/libvicar.a -VPATH += src -MOC_DIR = mocs -OBJECTS_DIR = objs - -SOURCES += src/main.cpp +VPATH += cpp +MOC_DIR = cpp/.mocs +OBJECTS_DIR = cpp/.objs -#MAKE INSTALL -INSTALLDIR = /../../debian/vicar +SOURCES += cpp/main.cpp INSTALLS += target - -target.path =$$INSTALLDIR/opt/vicar - +target.path =/opt/vicar/bin diff --git a/welcome b/welcome new file mode 100755 index 0000000..e69de29