[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:22:14 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=afd4692
The following commit has been merged in the master branch:
commit afd46925b088886ce461c9ed932d393f91674530
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Sun Jul 15 01:25:03 2012 +0100
Invite members to the chat room
---
app/CMakeLists.txt | 3 ++
app/chat-window.cpp | 9 +++-
app/invite-contact-dialog.cpp | 104 ++++++++++++++++++++++++++++++++++++++++++
app/invite-contact-dialog.h | 63 +++++++++++++++++++++++++
4 files changed, 177 insertions(+), 2 deletions(-)
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index 2e05cd7..3050e95 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -5,6 +5,7 @@ set(ktp-text-ui_SRCS
telepathy-chat-ui.cpp
chat-window.cpp
chat-tab.cpp
+ invite-contact-dialog.cpp
)
kde4_add_executable(ktp-text-ui ${ktp-text-ui_SRCS})
@@ -15,6 +16,8 @@ target_link_libraries(ktp-text-ui
${KDE4_KIO_LIBS}
${TELEPATHY_QT4_LIBRARIES}
${KTP_LIBRARIES}
+ ${KTP_MODELS_LIBRARIES}
+ ${KTP_WIDGETS_LIBRARIES}
${QT_QTWEBKIT_LIBRARY}
${KDE4_KNOTIFYCONFIG_LIBS}
${KDE4_KCMUTILS_LIBS}
diff --git a/app/chat-window.cpp b/app/chat-window.cpp
index 84bd6d6..785820c 100644
--- a/app/chat-window.cpp
+++ b/app/chat-window.cpp
@@ -56,6 +56,8 @@
#include <Sonnet/DictionaryComboBox>
+#include "invite-contact-dialog.h"
+
#define PREFERRED_TEXTCHAT_HANDLER "org.freedesktop.Telepathy.Client.KTp.TextUi"
#define PREFERRED_FILETRANSFER_HANDLER "org.freedesktop.Telepathy.Client.KTp.FileTransfer"
#define PREFERRED_AUDIO_VIDEO_HANDLER "org.freedesktop.Telepathy.Client.KTp.CallUi"
@@ -311,7 +313,7 @@ void ChatWindow::onCurrentIndexChanged(int index)
setVideoCallEnabled(selfCapabilities.streamedMediaVideoCalls() && contactCapabilites.streamedMediaVideoCalls());
setShareDesktopEnabled(s_krfbAvailableChecker->isAvailable() && contactCapabilites.streamTubes(QLatin1String("rfb")));
/// TODO re-activate check when invitation to chat has been sorted out
- setInviteToChatEnabled(false);
+ setInviteToChatEnabled(true);
toggleBlockButton(currentChatTab->textChannel()->targetContact()->isBlocked());
@@ -386,7 +388,10 @@ void ChatWindow::onGenericOperationFinished(Tp::PendingOperation* op)
void ChatWindow::onInviteToChatTriggered()
{
- /// TODO
+ ChatTab *currChat = qobject_cast<ChatTab*>(m_tabWidget->currentWidget());
+ InviteContactDialog *dialog = new InviteContactDialog(currChat->account(), currChat->textChannel(), this);
+ //FIXME delete on close
+ dialog->show();
}
void ChatWindow::onNextTabActionTriggered()
diff --git a/app/invite-contact-dialog.cpp b/app/invite-contact-dialog.cpp
new file mode 100644
index 0000000..fa0f029
--- /dev/null
+++ b/app/invite-contact-dialog.cpp
@@ -0,0 +1,104 @@
+/*
+ * Contact Chooser Dialog
+ *
+ * Copyright (C) 2011 David Edmundson <kde at davidedmundson.co.uk>
+ * Copyright (C) 2012 Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#include "invite-contact-dialog.h"
+
+#include <KDE/KLineEdit>
+#include <KDE/KPushButton>
+#include <KDE/KLocalizedString>
+#include <KDE/KDebug>
+
+#include <TelepathyQt/Contact>
+#include <TelepathyQt/TextChannel>
+
+#include <KTp/debug.h>
+#include <KTp/Models/accounts-model.h>
+#include <KTp/Models/accounts-filter-model.h>
+#include <KTp/Widgets/contact-grid-widget.h>
+#include <telepathy-qt4/TelepathyQt/PendingChannelRequest>
+
+InviteContactDialog::InviteContactDialog(const Tp::AccountPtr &account, const Tp::TextChannelPtr &channel, QWidget *parent) :
+ KDialog(parent),
+ m_account(account),
+ m_channel(channel)
+{
+ resize(500,450);
+
+ m_accountsModel = new AccountsModel(this);
+ m_accountsModel->setAccount(account);
+
+
+ m_contactGridWidget = new KTp::ContactGridWidget(m_accountsModel, this);
+ m_contactGridWidget->contactFilterLineEdit()->setClickMessage(i18n("Search in Contacts..."));
+ m_contactGridWidget->filter()->setPresenceTypeFilterFlags(AccountsFilterModel::ShowOnlyConnected);
+ setMainWidget(m_contactGridWidget);
+
+ connect(m_contactGridWidget,
+ SIGNAL(selectionChanged(Tp::AccountPtr,Tp::ContactPtr)),
+ SLOT(onChanged()));
+
+ button(KDialog::Ok)->setDisabled(true);
+
+ connect(this, SIGNAL(okClicked()), SLOT(onOkClicked()));
+ connect(this, SIGNAL(rejected()), SLOT(close()));
+}
+
+Tp::AccountPtr InviteContactDialog::account() const
+{
+ return m_account;
+}
+
+Tp::TextChannelPtr InviteContactDialog::channel() const
+{
+ return m_channel;
+}
+
+void InviteContactDialog::onOkClicked()
+{
+ // don't do anytghing if no contact has been selected
+ if (!m_contactGridWidget->hasSelection()) {
+ // show message box?
+ return;
+ }
+
+ Tp::ContactPtr contact = m_contactGridWidget->selectedContact();
+
+ if (contact.isNull() || m_channel.isNull() || m_account.isNull()) {
+ return;
+ }
+
+ //if can invite do so, otherwise make a new channel with the new contacts
+ if (m_channel->canInviteContacts()) {
+ m_channel->inviteContacts(QList<Tp::ContactPtr>() << contact);
+ }
+ else {
+ QList<Tp::ContactPtr> contacts;
+ contacts << contact;
+ contacts << m_channel->groupContacts(false).toList();
+ m_account->createConferenceTextChat(QList<Tp::ChannelPtr>() << m_channel, contacts);
+ }
+}
+
+void InviteContactDialog::onChanged()
+{
+ button(KDialog::Ok)->setEnabled(m_contactGridWidget->hasSelection());
+}
diff --git a/app/invite-contact-dialog.h b/app/invite-contact-dialog.h
new file mode 100644
index 0000000..f77a77c
--- /dev/null
+++ b/app/invite-contact-dialog.h
@@ -0,0 +1,63 @@
+/*
+ * Contact Chooser Dialog
+ *
+ * Copyright (C) 2012 David Edmundson <kde at davidedmundson.co.uk>
+ * Copyright (C) 2012 Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+#ifndef INVITECONTACTDIALOG_H
+#define INVITECONTACTDIALOG_H
+
+#include <KDialog>
+#include <TelepathyQt/Types>
+#include <TelepathyQt/TextChannel>
+#include <TelepathyQt/Account>
+
+namespace Tp {
+class PendingOperation;
+}
+
+namespace KTp {
+class ContactGridWidget;
+}
+
+class AccountsModel;
+class QTcpSocket;
+
+class InviteContactDialog : public KDialog
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(InviteContactDialog)
+
+public:
+ InviteContactDialog(const Tp::AccountPtr &account, const Tp::TextChannelPtr &channel, QWidget *parent);
+ Tp::AccountPtr account() const;
+ Tp::TextChannelPtr channel() const;
+
+private Q_SLOTS:
+ void onOkClicked();
+ void onChanged();
+
+private:
+ Tp::AccountPtr m_account;
+ Tp::TextChannelPtr m_channel;
+ AccountsModel *m_accountsModel;
+ KTp::ContactGridWidget *m_contactGridWidget;
+};
+
+#endif // CONTACTDIALOG_H
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list