[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/network/kcall
From:       George Kiagiadakis <gkiagiad () csd ! uoc ! gr>
Date:       2009-07-11 12:06:47
Message-ID: 1247314007.642089.24533.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 994793 by gkiagia:

Add ui for dialing sip addresses directly.

 M  +30 -0     mainwindow.cpp  
 M  +1 -0      mainwindow.h  
 M  +94 -5     mainwindow.ui  


--- trunk/playground/network/kcall/mainwindow.cpp #994792:994793
@@ -24,7 +24,10 @@
 #include <KStatusBar>
 #include <KAction>
 #include <KActionCollection>
+#include <TelepathyQt4/Account>
 
+Q_DECLARE_METATYPE(Tp::AccountPtr)
+
 MainWindow::MainWindow()
     : KXmlGuiWindow(),
       ui(new Ui::MainWindow)
@@ -38,6 +41,9 @@
     ui->contactsTreeView->setModel(KCallApplication::instance()->contactsModel());
     new ContactListController(ui->contactsTreeView, KCallApplication::instance()->contactsModel());
 
+    ui->accountComboBox->setModel(KCallApplication::instance()->contactsModel());
+    connect(ui->dialButton, SIGNAL(clicked()), SLOT(onDialButtonClicked()));
+
     setupActions();
     setupGUI(QSize(340, 460));
 }
@@ -63,4 +69,28 @@
     }
 }
 
+void MainWindow::onDialButtonClicked()
+{
+    int row = ui->accountComboBox->currentIndex();
+    QString id = ui->contactHandleLineEdit->text();
+    if ( row < 0  || id.isEmpty() ) {
+        return;
+    }
+
+    TreeModel *model = qobject_cast<TreeModel*>(ui->accountComboBox->model());
+    Q_ASSERT(model);
+
+    Tp::AccountPtr account = model->index(row, 0).data(KCall::ObjectPtrRole).value<Tp::AccountPtr>();
+    Q_ASSERT( !account.isNull() );
+
+    QVariantMap request;
+    request.insert(TELEPATHY_INTERFACE_CHANNEL ".ChannelType",
+                   TELEPATHY_INTERFACE_CHANNEL_TYPE_STREAMED_MEDIA);
+    request.insert(TELEPATHY_INTERFACE_CHANNEL ".TargetHandleType", Tp::HandleTypeContact);
+    request.insert(TELEPATHY_INTERFACE_CHANNEL ".TargetID", id);
+   // request.insert(TELEPATHY_INTERFACE_CHANNEL_TYPE_STREAMED_MEDIA ".FUTURE.InitialAudio", true);
+    account->ensureChannel(request, QDateTime::currentDateTime(),
+                           "org.freedesktop.Telepathy.Client.kcall_handler");
+}
+
 #include "mainwindow.moc"
--- trunk/playground/network/kcall/mainwindow.h #994792:994793
@@ -29,6 +29,7 @@
 
 private slots:
     void showSettingsDialog();
+    void onDialButtonClicked();
 
 private:
     void setupActions();
--- trunk/playground/network/kcall/mainwindow.ui #994792:994793
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>322</width>
-    <height>488</height>
+    <width>285</width>
+    <height>388</height>
    </rect>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
@@ -26,19 +26,108 @@
          <attribute name="headerVisible">
           <bool>false</bool>
          </attribute>
-         <attribute name="headerVisible">
-          <bool>false</bool>
-         </attribute>
         </widget>
        </item>
       </layout>
      </widget>
+     <widget class="QWidget" name="dialTab">
+      <attribute name="title">
+       <string>Dial directly</string>
+      </attribute>
+      <layout class="QGridLayout" name="gridLayout">
+       <item row="0" column="1">
+        <spacer name="verticalSpacer">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeType">
+          <enum>QSizePolicy::Preferred</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>93</width>
+           <height>48</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item row="1" column="0" colspan="3">
+        <layout class="QFormLayout" name="formLayout">
+         <item row="0" column="0">
+          <widget class="QLabel" name="accountLabel">
+           <property name="text">
+            <string>Account</string>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="1">
+          <widget class="KComboBox" name="accountComboBox">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="0">
+          <widget class="QLabel" name="contactHandleLabel">
+           <property name="text">
+            <string>Contact handle</string>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1">
+          <widget class="KLineEdit" name="contactHandleLineEdit"/>
+         </item>
+        </layout>
+       </item>
+       <item row="2" column="1">
+        <widget class="KPushButton" name="dialButton">
+         <property name="text">
+          <string>Dial</string>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="1">
+        <spacer name="verticalSpacer_2">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeType">
+          <enum>QSizePolicy::Expanding</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>93</width>
+           <height>193</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </widget>
     </widget>
    </item>
   </layout>
  </widget>
  <customwidgets>
   <customwidget>
+   <class>KPushButton</class>
+   <extends>QPushButton</extends>
+   <header>kpushbutton.h</header>
+  </customwidget>
+  <customwidget>
+   <class>KLineEdit</class>
+   <extends>QLineEdit</extends>
+   <header>klineedit.h</header>
+  </customwidget>
+  <customwidget>
+   <class>KComboBox</class>
+   <extends>QComboBox</extends>
+   <header>kcombobox.h</header>
+  </customwidget>
+  <customwidget>
    <class>KTabWidget</class>
    <extends>QTabWidget</extends>
    <header>ktabwidget.h</header>
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic