[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:43 UTC 2016


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

The following commit has been merged in the master branch:
commit 69407ff24a143d0c7d6b54ebdeb33ac1393ebe89
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Fri Sep 9 20:07:01 2011 +0100

    Added config KCM to configure tab behavior in the Text UI
    Based on the work by Lasath Fernando
---
 config/CMakeLists.txt                              |  39 ++++++--
 config/{main-window.cpp => appearance-config.cpp}  |  35 +++----
 config/{main-window.h => appearance-config.h}      |   6 +-
 .../{chatwindowconfig.ui => appearance-config.ui}  |   0
 config/behavior-config.cpp                         | 109 +++++++++++++++++++++
 lib/chat-text-edit.h => config/behavior-config.h   |  51 +++++-----
 config/behavior-config.ui                          |  91 +++++++++++++++++
 ...> kcm_telepathy_chat_appearance_config.desktop} |   0
 config/kcm_telepathy_chat_behavior_config.desktop  |  14 +++
 9 files changed, 289 insertions(+), 56 deletions(-)

diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt
index f624431..ba8031e 100644
--- a/config/CMakeLists.txt
+++ b/config/CMakeLists.txt
@@ -1,23 +1,42 @@
 include_directories(${TELEPATHY_KDE_TEXT_UI_SOURCE_DIR}/lib)
 
-set(telepathy_chat_config_SRCS
-        main-window.cpp
+set(telepathy_chat_appearance_config_SRCS
+        appearance-config.cpp
 )
 
-set(telepathy_chat_config_UI
-    chatwindowconfig.ui
+set(telepathy_chat_behavior_config_SRCS
+        behavior-config.cpp
 )
 
-kde4_add_ui_files(telepathy_chat_config_SRCS ${telepathy_chat_config_UI})
+set(telepathy_chat_appearance_config_UI
+    appearance-config.ui
+)
+
+set(telepathy_chat_behavior_config_UI
+    behavior-config.ui
+)
+
+kde4_add_ui_files(telepathy_chat_appearance_config_SRCS ${telepathy_chat_appearance_config_UI})
+
+kde4_add_plugin(kcm_telepathy_chat_appearance_config
+		    ${telepathy_chat_appearance_config_SRCS})
+
+target_link_libraries(kcm_telepathy_chat_appearance_config ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${QT_QTWEBKIT_LIBRARY} ${KDE4_KCMUTILS_LIBS} ktelepathy_chat_lib)
+
+
+kde4_add_ui_files(telepathy_chat_behavior_config_SRCS ${telepathy_chat_behavior_config_UI})
+
+kde4_add_plugin(kcm_telepathy_chat_behavior_config
+                    ${telepathy_chat_behavior_config_SRCS})
 
-kde4_add_plugin(kcm_telepathy_chat_config
-		    ${telepathy_chat_config_SRCS})
+target_link_libraries(kcm_telepathy_chat_behavior_config ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KCMUTILS_LIBS} ktelepathy_chat_lib)
 
-target_link_libraries(kcm_telepathy_chat_config ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${QT_QTWEBKIT_LIBRARY} ${KDE4_KCMUTILS_LIBS} ktelepathy_chat_lib)
 
-install(TARGETS kcm_telepathy_chat_config
+install(TARGETS kcm_telepathy_chat_appearance_config
+                kcm_telepathy_chat_behavior_config
 	  DESTINATION ${PLUGIN_INSTALL_DIR})
 
-install (FILES kcm_telepathy_chat_config.desktop
+install (FILES kcm_telepathy_chat_appearance_config.desktop
+               kcm_telepathy_chat_behavior_config.desktop
          DESTINATION ${SERVICES_INSTALL_DIR}
 )
diff --git a/config/main-window.cpp b/config/appearance-config.cpp
similarity index 87%
copy from config/main-window.cpp
copy to config/appearance-config.cpp
index 3a79da4..4df5fad 100644
--- a/config/main-window.cpp
+++ b/config/appearance-config.cpp
@@ -17,7 +17,7 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
-#include "main-window.h"
+#include "appearance-config.h"
 #include "ui_chatwindowconfig.h"
 
 #include <KDETelepathy/ChatWindowStyleManager>
@@ -28,12 +28,13 @@
 
 #include <KDebug>
 #include <KLocalizedString>
+#include <KPluginFactory>
 
-K_PLUGIN_FACTORY(KCMTelepathyChatConfigFactory, registerPlugin<MainWindow>();)
-K_EXPORT_PLUGIN(KCMTelepathyChatConfigFactory("telepathy_chat_config", "kcm_telepathy_chat_config"))
+K_PLUGIN_FACTORY(KCMTelepathyChatAppearanceConfigFactory, registerPlugin<AppearanceConfig>();)
+K_EXPORT_PLUGIN(KCMTelepathyChatAppearanceConfigFactory("telepathy_chat_appearance_config", "kcm_telepathy_chat_appearance_config"))
 
-MainWindow::MainWindow(QWidget *parent, const QVariantList& args)
-    : KCModule(KCMTelepathyChatConfigFactory::componentData(), parent, args),
+AppearanceConfig::AppearanceConfig(QWidget *parent, const QVariantList& args)
+    : KCModule(KCMTelepathyChatAppearanceConfigFactory::componentData(), parent, args),
       ui(new Ui::ChatWindowConfig)
 {
     ui->setupUi(this);
@@ -64,12 +65,12 @@ MainWindow::MainWindow(QWidget *parent, const QVariantList& args)
     connect(ui->fontSize, SIGNAL(valueChanged(int)), SLOT(onFontSizeChanged(int)));
 }
 
-MainWindow::~MainWindow()
+AppearanceConfig::~AppearanceConfig()
 {
     delete ui;
 }
 
-void MainWindow::changeEvent(QEvent *e)
+void AppearanceConfig::changeEvent(QEvent *e)
 {
     QWidget::changeEvent(e);
     switch (e->type()) {
@@ -81,7 +82,7 @@ void MainWindow::changeEvent(QEvent *e)
     }
 }
 
-void MainWindow::onStylesLoaded()
+void AppearanceConfig::onStylesLoaded()
 {
     kDebug();
 
@@ -106,7 +107,7 @@ void MainWindow::onStylesLoaded()
     //FIXME call onStyleSelected
 }
 
-void MainWindow::updateVariantsList()
+void AppearanceConfig::updateVariantsList()
 {
     kDebug();
     QHash<QString, QString> variants = ui->chatView->chatStyle()->getVariants();
@@ -115,7 +116,7 @@ void MainWindow::updateVariantsList()
     ui->variantComboBox->setCurrentItem(ui->chatView->variantName());
 }
 
-void MainWindow::onStyleSelected(int index)
+void AppearanceConfig::onStyleSelected(int index)
 {
     kDebug();
     //load the style.
@@ -132,7 +133,7 @@ void MainWindow::onStyleSelected(int index)
     changed();
 }
 
-void MainWindow::onVariantSelected(const QString &variant)
+void AppearanceConfig::onVariantSelected(const QString &variant)
 {
     kDebug();
     ui->chatView->setVariant(variant);
@@ -140,14 +141,14 @@ void MainWindow::onVariantSelected(const QString &variant)
     changed();
 }
 
-void MainWindow::onShowHeaderChanged(bool showHeader)
+void AppearanceConfig::onShowHeaderChanged(bool showHeader)
 {
     ui->chatView->setHeaderDisplayed(showHeader);
     ui->chatView->initialise(m_demoChatHeader);
     changed();
 }
 
-void MainWindow::onFontGroupChanged(bool useCustomFont)
+void AppearanceConfig::onFontGroupChanged(bool useCustomFont)
 {
     kDebug();
     ui->chatView->setUseCustomFont(useCustomFont);
@@ -155,7 +156,7 @@ void MainWindow::onFontGroupChanged(bool useCustomFont)
     changed();
 }
 
-void MainWindow::onFontFamilyChanged(QFont fontFamily)
+void AppearanceConfig::onFontFamilyChanged(QFont fontFamily)
 {
     kDebug() << fontFamily.family();
     ui->chatView->setFontFamily(fontFamily.family());
@@ -163,7 +164,7 @@ void MainWindow::onFontFamilyChanged(QFont fontFamily)
     changed();
 }
 
-void MainWindow::onFontSizeChanged(int fontSize)
+void AppearanceConfig::onFontSizeChanged(int fontSize)
 {
     kDebug() << fontSize;
     ui->chatView->setFontSize(fontSize);
@@ -171,7 +172,7 @@ void MainWindow::onFontSizeChanged(int fontSize)
     changed();
 }
 
-void MainWindow::sendDemoMessages()
+void AppearanceConfig::sendDemoMessages()
 {
     //add a fake message
 
@@ -199,7 +200,7 @@ void MainWindow::sendDemoMessages()
     ui->chatView->addStatusMessage(statusMessage);
 }
 
-void MainWindow::save()
+void AppearanceConfig::save()
 {
     kDebug();
 
diff --git a/config/main-window.h b/config/appearance-config.h
similarity index 94%
copy from config/main-window.h
copy to config/appearance-config.h
index e95bf93..efe9706 100644
--- a/config/main-window.h
+++ b/config/appearance-config.h
@@ -30,14 +30,14 @@ namespace Ui
 }
 
 
-class MainWindow : public KCModule
+class AppearanceConfig : public KCModule
 {
     Q_OBJECT
 
 public:
-    explicit MainWindow(QWidget *parent = 0,
+    explicit AppearanceConfig(QWidget *parent = 0,
 				const QVariantList& args = QVariantList());
-    ~MainWindow();
+    ~AppearanceConfig();
 
 public slots:
     void save();
diff --git a/config/chatwindowconfig.ui b/config/appearance-config.ui
similarity index 100%
copy from config/chatwindowconfig.ui
copy to config/appearance-config.ui
diff --git a/config/behavior-config.cpp b/config/behavior-config.cpp
new file mode 100644
index 0000000..26a65a6
--- /dev/null
+++ b/config/behavior-config.cpp
@@ -0,0 +1,109 @@
+/***************************************************************************
+ *   Copyright (C) 2011 by Lasath Fernando <kde at lasath.org>                *
+ *   Copyright (C) 2011 by David Edmundson <kde at davidedmundson.co.uk>      *
+ *                                                                         *
+ *   This program 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 program 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 program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
+ ***************************************************************************/
+
+#include "behavior-config.h"
+#include "ui_behavior-config.h"
+
+#include <KDebug>
+#include <KPluginFactory>
+
+K_PLUGIN_FACTORY(KCMTelepathyChatBehaviorConfigFactory, registerPlugin<BehaviorConfig>();)
+K_EXPORT_PLUGIN(KCMTelepathyChatBehaviorConfigFactory("telepathy_chat_behavior_config", "kcm_telepathy_chat_behavior_config"))
+
+
+BehaviorConfig::BehaviorConfig(QWidget *parent, const QVariantList& args)
+    : KCModule(KCMTelepathyChatBehaviorConfigFactory::componentData(), parent, args),
+      ui(new Ui::BehaviorConfigUi())
+{
+    kDebug();
+
+    load();
+
+    ui->setupUi(this);
+
+    ui->newTabButtonGroup->setId(ui->radioLast, TelepathyChatUi::LastWindow);
+    ui->newTabButtonGroup->setId(ui->radioNew, TelepathyChatUi::NewWindow);
+    ui->newTabButtonGroup->setId(ui->radioZero, TelepathyChatUi::FirstWindow);
+
+    ui->newTabButtonGroup->button(m_openMode)->setChecked(true);
+    connect(ui->newTabButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(onRadioSelected(int)));
+}
+
+BehaviorConfig::~BehaviorConfig()
+{
+    delete ui;
+}
+
+void BehaviorConfig::load()
+{
+    KSharedConfigPtr config = KSharedConfig::openConfig("ktelepathyrc");
+    KConfigGroup tabConfig = config->group("Behavior");
+
+    QString mode = tabConfig.readEntry("tabOpenMode", "NewWindow");
+    if(mode == "NewWindow"){
+        m_openMode = TelepathyChatUi::NewWindow;
+    } else if (mode == "FirstWindow"){
+        m_openMode = TelepathyChatUi::FirstWindow;
+    } else if (mode == "LastWindow"){
+        m_openMode = TelepathyChatUi::LastWindow;
+    }
+}
+
+void BehaviorConfig::save()
+{
+    KSharedConfigPtr config = KSharedConfig::openConfig("ktelepathyrc");
+    KConfigGroup tabConfig = config->group("Behavior");
+
+    QString mode;
+    switch (m_openMode) {
+        case TelepathyChatUi::NewWindow :
+            mode = "NewWindow";
+            break;
+        case TelepathyChatUi::FirstWindow :
+            mode = "FirstWindow";
+            break;
+        case TelepathyChatUi::LastWindow :
+            mode = "LastWindow";
+            break;
+    }
+
+    tabConfig.writeEntry("tabOpenMode", mode);
+    tabConfig.sync();
+}
+
+void BehaviorConfig::changeEvent(QEvent* e)
+{
+    QWidget::changeEvent(e);
+    switch (e->type()) {
+    case QEvent::LanguageChange:
+        ui->retranslateUi(this);
+        break;
+    default:
+        break;
+    }
+}
+
+void BehaviorConfig::onRadioSelected(int id)
+{
+    kDebug() << "BehaviorConfig::m_openMode changed from " << id << " to " << m_openMode;
+    m_openMode = (TelepathyChatUi::TabOpenMode) id;
+    kDebug() << "emitting changed(true)";
+    Q_EMIT changed(true);
+}
diff --git a/lib/chat-text-edit.h b/config/behavior-config.h
similarity index 64%
copy from lib/chat-text-edit.h
copy to config/behavior-config.h
index c643db2..ff205b4 100644
--- a/lib/chat-text-edit.h
+++ b/config/behavior-config.h
@@ -1,5 +1,7 @@
 /***************************************************************************
- *   Copyright (C) 2011 by David Edmundson <kde at davidedmundson.co.uk>      *
+ *   Copyright (C) 2011 by Lasath Fernando <kde at lasath.org>
+ *   Copyright (C) 2011 by David Edmundson <kde at lasath.org>
+ *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
@@ -17,41 +19,38 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
-#ifndef CHATTEXTEDIT_H
-#define CHATTEXTEDIT_H
 
-#include <KTextEdit>
+#ifndef BEHAVIOR_CONFIG_H
+#define BEHAVIOR_CONFIG_H
 
-class ChatTextEdit : public KTextEdit
+#include <KCModule>
+#include "../app/telepathy-chat-ui.h"
+
+namespace Ui {
+class BehaviorConfigUi;
+}
+
+class BehaviorConfig : public KCModule
 {
     Q_OBJECT
+
 public:
-    explicit ChatTextEdit(QWidget *parent = 0);
+    explicit BehaviorConfig(QWidget *parent = 0, const QVariantList &args = QVariantList());
+    virtual ~BehaviorConfig();
 
-    // reimplemented
-    QSize minimumSizeHint() const;
-    QSize sizeHint() const;
+public slots:
+    virtual void load();
+    virtual void save();
 
 protected:
-    /// HACK this method is overridden to catch the ctrl+f signal for the toggleSearchBar.
-    void keyPressEvent(QKeyEvent *e);
-
-    // reimplemented
-    void resizeEvent(QResizeEvent*);
+    virtual void changeEvent(QEvent *e);
 
 private slots:
-    void recalculateSize();
-    void updateScrollBar();
+    void onRadioSelected(int id);
 
-signals:
-    void findTextShortcutPressed();
-    void scrollEventRecieved(QKeyEvent*);
-
-public slots:
-    /** wraps setFontWeight to a simple on/off bold) */
-    void setFontBold(bool);
+private:
+    int m_openMode;
+    Ui::BehaviorConfigUi* ui;
 };
 
-#endif // CHATTEXTEDIT_H
-
-
+#endif // BEHAVIOR_CONFIG_H
diff --git a/config/behavior-config.ui b/config/behavior-config.ui
new file mode 100644
index 0000000..4d63cda
--- /dev/null
+++ b/config/behavior-config.ui
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>BehaviorConfigUi</class>
+ <widget class="QWidget" name="BehaviorConfigUi">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>357</width>
+    <height>296</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="KButtonGroup" name="newTabGroup">
+     <property name="title">
+      <string>Tabs</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout_3">
+      <item>
+       <widget class="QLabel" name="label">
+        <property name="text">
+         <string>Open new conversations in :</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QRadioButton" name="radioNew">
+        <property name="text">
+         <string>A new window</string>
+        </property>
+        <attribute name="buttonGroup">
+         <string>newTabButtonGroup</string>
+        </attribute>
+       </widget>
+      </item>
+      <item>
+       <widget class="QRadioButton" name="radioZero">
+        <property name="text">
+         <string>A new tab in the first window</string>
+        </property>
+        <attribute name="buttonGroup">
+         <string>newTabButtonGroup</string>
+        </attribute>
+       </widget>
+      </item>
+      <item>
+       <widget class="QRadioButton" name="radioLast">
+        <property name="text">
+         <string>A new tab in the last focused window</string>
+        </property>
+        <attribute name="buttonGroup">
+         <string>newTabButtonGroup</string>
+        </attribute>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>KButtonGroup</class>
+   <extends>QGroupBox</extends>
+   <header>kbuttongroup.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+ <buttongroups>
+  <buttongroup name="newTabButtonGroup"/>
+ </buttongroups>
+</ui>
\ No newline at end of file
diff --git a/config/kcm_telepathy_chat_config.desktop b/config/kcm_telepathy_chat_appearance_config.desktop
similarity index 100%
rename from config/kcm_telepathy_chat_config.desktop
rename to config/kcm_telepathy_chat_appearance_config.desktop
diff --git a/config/kcm_telepathy_chat_behavior_config.desktop b/config/kcm_telepathy_chat_behavior_config.desktop
new file mode 100644
index 0000000..175aadf
--- /dev/null
+++ b/config/kcm_telepathy_chat_behavior_config.desktop
@@ -0,0 +1,14 @@
+[Desktop Entry]
+Icon=tab-duplicate
+StartupNotify=true
+Terminal=false
+Type=Service
+X-KDE-ServiceTypes=KCModule
+X-DBUS-StartupType=
+X-KDE-HasReadOnlyMode=false
+X-KDE-Library=kcm_telepathy_chat_behavior_config
+X-KDE-SubstituteUID=false
+X-KDE-RootOnly=false
+Categories=Qt;KDE;X-KDE-settings-network;
+
+Name=Chat Tab Behavior

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list