[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:19:33 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=7210f3d

The following commit has been merged in the master branch:
commit 7210f3d3e48110d41b3627a608221fb7d266cfa7
Author: Lasath Fernando <kde at lasath.org>
Date:   Wed Jul 6 10:45:09 2011 +0530

    Added an option for new tab behavior
    
    Created enum TabOpenMode in TelepathyChatUi.
---
 app/chat-tab.cpp          |  4 ++--
 app/chat-window.cpp       |  8 ++++----
 app/chat-window.h         | 13 +++++--------
 app/telepathy-chat-ui.cpp | 30 ++++++++++++++++++++++++++----
 app/telepathy-chat-ui.h   | 10 ++++++++--
 5 files changed, 45 insertions(+), 20 deletions(-)

diff --git a/app/chat-tab.cpp b/app/chat-tab.cpp
index d347602..018868e 100644
--- a/app/chat-tab.cpp
+++ b/app/chat-tab.cpp
@@ -51,9 +51,9 @@ void ChatTab::setWindow(ChatWindow* window)
     if(m_chatWindow) {
         m_chatWindow->removeTab(this);
     }
-    
+
     m_chatWindow = window;
-    
+
     if(window) {
         window->addTab(this);
     }
diff --git a/app/chat-window.cpp b/app/chat-window.cpp
index 86e2cf6..374babe 100644
--- a/app/chat-window.cpp
+++ b/app/chat-window.cpp
@@ -179,10 +179,10 @@ void ChatWindow::addTab ( ChatTab* tab )
 void ChatWindow::destroyTab(QWidget* chatWidget)
 {
     kDebug();
-    
+
     ChatTab* tab = qobject_cast<ChatTab*>(chatWidget);
     Q_ASSERT(tab);
-    
+
     tab->setWindow(NULL);
     delete chatWidget;
 }
@@ -417,10 +417,10 @@ void ChatWindow::showNotificationsDialog()
 void ChatWindow::createNewChat(const Tp::TextChannelPtr &channelPtr, const Tp::AccountPtr &accountPtr)
 {
     kDebug();
-    
+
     ChatTab *chatTab = new ChatTab(channelPtr, accountPtr, m_tabWidget);
     setupChatTabSignals(chatTab);
-    
+
     chatTab->setWindow(this);
 }
 
diff --git a/app/chat-window.h b/app/chat-window.h
index 5499101..0015ba8 100644
--- a/app/chat-window.h
+++ b/app/chat-window.h
@@ -47,14 +47,13 @@ public:
      * chat doesn't already exist
      * @param incomingTextChannel new text channel
      */
-//     void startChat(const Tp::TextChannelPtr &incomingTextChannel, const Tp::AccountPtr &account);
     void destroyTab(ChatTab *chatWidget);
     void setTabText(int index, const QString &newTitle);
     void setTabIcon(int index, const KIcon &newIcon);
     void setTabTextColor(int index,const QColor &color);
-	ChatTab* getTab(const Tp::TextChannelPtr &incomingTextChannel);
-	void focusChat(ChatTab* tab);
-	/** creats a new chat and adds it to the tab widget
+    ChatTab* getTab(const Tp::TextChannelPtr &incomingTextChannel);
+    void focusChat(ChatTab* tab);
+    /** creats a new chat and adds it to the tab widget
      * @param channelPtr pointer to textChannel to use
      */
     void createNewChat(const Tp::TextChannelPtr &channelPtr, const Tp::AccountPtr &account);
@@ -66,7 +65,7 @@ public:
 signals:
     void aboutToClose();
     void dettachRequested(ChatTab*);
-    
+
 public slots:
     void destroyTab(QWidget *chatWidget);
 
@@ -94,8 +93,6 @@ protected slots:
     void showNotificationsDialog();
 
 private:
-    
-
     /** sends notification to the user via plasma desktop notification system
      * @param type notification type
      * @param errorMsg message to display
@@ -135,7 +132,7 @@ private:
     void startVideoCall(const Tp::AccountPtr &account, const Tp::ContactPtr &contact);
 
     KTabWidget *m_tabWidget;
-	
+
 	TelepathyChatUi* m_chatUi;
 };
 
diff --git a/app/telepathy-chat-ui.cpp b/app/telepathy-chat-ui.cpp
index 819f0ff..c60a30c 100644
--- a/app/telepathy-chat-ui.cpp
+++ b/app/telepathy-chat-ui.cpp
@@ -23,6 +23,7 @@
 #include <KDebug>
 #include <TelepathyQt4/ChannelClassSpec>
 #include <TelepathyQt4/TextChannel>
+#include <KConfigGroup>
 
 inline Tp::ChannelClassSpecList channelClassList()
 {
@@ -36,7 +37,19 @@ TelepathyChatUi::TelepathyChatUi()
     : KApplication(), AbstractClientHandler(channelClassList())
 {
     kDebug();
-    createWindow();
+
+    KSharedConfigPtr config = KSharedConfig::openConfig("ktelepathyrc");
+    KConfigGroup tabConfig = config->group("Behavior");
+
+    QString mode = tabConfig.readEntry("tabOpenMode", "NewWindow");
+    if(mode == "NewWindow"){
+        openMode = NewWindow;
+    } else if (mode == "FirstWindow"){
+        openMode = FirstWindow;
+        createWindow();
+    } else if (mode == "LastWindow"){
+        openMode = LastWindow;
+    }
 }
 
 void TelepathyChatUi::removeWindow()
@@ -54,7 +67,7 @@ ChatWindow* TelepathyChatUi::createWindow()
     connect(window, SIGNAL(aboutToClose()), SLOT(removeWindow()));
     connect(window, SIGNAL(dettachRequested(ChatTab*)), SLOT(dettachTab(ChatTab*)));
     m_chatWindows.push_back(window);
-    
+
     return window;
 }
 
@@ -99,7 +112,7 @@ void TelepathyChatUi::handleChannels(const Tp::MethodInvocationContextPtr<> & co
         ChatTab* tab = window->getTab(textChannel);
         if(tab){
             tabFound = true;
-            
+
             tab->showOnTop();                                       // set focus on selected tab
 
             // check if channel is invalid. Replace only if invalid
@@ -112,7 +125,16 @@ void TelepathyChatUi::handleChannels(const Tp::MethodInvocationContextPtr<> & co
     }
 
     if(!tabFound) {
-        ChatWindow* window = m_chatWindows[0];
+        ChatWindow* window = NULL;
+        switch (openMode) {
+            case FirstWindow:
+                window = m_chatWindows[0];
+                break;
+            case LastWindow:
+            case NewWindow:
+                window = createWindow();
+                break;
+        }
         window->createNewChat(textChannel, account);
         window->show();
     }
diff --git a/app/telepathy-chat-ui.h b/app/telepathy-chat-ui.h
index 819e10e..ad6809f 100644
--- a/app/telepathy-chat-ui.h
+++ b/app/telepathy-chat-ui.h
@@ -43,15 +43,21 @@ public:
             const Tp::AbstractClientHandler::HandlerInfo & handlerInfo);
 
     virtual bool bypassApproval() const;
-    
+
 private slots:
 	void removeWindow();
     void dettachTab(ChatTab*);
 
 private:
     ChatWindow* createWindow();
-    
+
     QList<ChatWindow*> m_chatWindows;
+
+    enum TabOpenMode {
+        NewWindow,
+        FirstWindow,
+        LastWindow
+    } openMode;
 };
 
 #endif // TELEPATHYCHATUI_H

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list