[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:21 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=b7b16ed
The following commit has been merged in the master branch:
commit b7b16edf018aef27e7d7e8d31ae9f7765f56c4d8
Author: Francesco Nwokeka <francesco.nwokeka at gmail.com>
Date: Thu Jun 16 14:40:38 2011 +0200
Part 2of3 - ADD new action buttons to chat handler
Buttons are now connected apart from the "inviteToChat" which still needs working on (seperate
patch. Involves group chats)
ADD: plasma notifications for errors
REVIEW: 101622
BUG: 275244
Reviewed By: David Edmundson
---
app/CMakeLists.txt | 1 +
app/chat-window.cpp | 111 ++++++++++++++++++++++++++++++++++++-
app/chat-window.h | 50 +++++++++++++----
app/telepathy-kde-text-ui.notifyrc | 53 ++++++++++++++++++
4 files changed, 202 insertions(+), 13 deletions(-)
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index dd1a23a..0895b1a 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -27,3 +27,4 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Telepathy.Client.KDE.T
install(FILES KDE.TextUi.client DESTINATION ${SHARE_INSTALL_PREFIX}/telepathy/clients/)
install(FILES chatwindow.rc
DESTINATION ${DATA_INSTALL_DIR}/telepathy-kde-text-ui/)
+install(FILES telepathy-kde-text-ui.notifyrc DESTINATION ${DATA_INSTALL_DIR}/telepathy-kde-text-ui)
diff --git a/app/chat-window.cpp b/app/chat-window.cpp
index 7fe5f51..38a10d1 100644
--- a/app/chat-window.cpp
+++ b/app/chat-window.cpp
@@ -29,17 +29,24 @@
#include <KAction>
#include <KActionCollection>
#include <KDebug>
+#include <KFileDialog>
#include <KIcon>
#include <KColorScheme>
#include <KTabBar>
#include <KSettings/Dialog>
+#include <KNotification>
#include <KNotifyConfigWidget>
#include <KMenuBar>
#include <KLineEdit>
#include <TelepathyQt4/Account>
+#include <TelepathyQt4/PendingChannelRequest>
#include <TelepathyQt4/TextChannel>
+#define PREFERRED_TEXTCHAT_HANDLER "org.freedesktop.Telepathy.Client.KDE.TextUi"
+#define PREFERRED_FILETRANSFER_HANDLER "org.freedesktop.Telepathy.Client.KDE.FileTransfer"
+#define PREFERRED_AUDIO_VIDEO_HANDLER "org.freedesktop.Telepathy.Client.KDE.CallUi"
+
ChatWindow::ChatWindow()
{
//setup actions
@@ -165,7 +172,14 @@ void ChatWindow::closeCurrentTab()
void ChatWindow::onAudioCallTriggered()
{
- /// TODO
+ ChatWidget *currChat = qobject_cast<ChatWidget*>(m_tabWidget->currentWidget());
+
+ // a check. Should never happen
+ if (!currChat) {
+ return;
+ }
+
+ startAudioCall(currChat->account(), currChat->textChannel()->targetContact());
}
void ChatWindow::onCurrentIndexChanged(int index)
@@ -197,7 +211,15 @@ void ChatWindow::onEnableSearchActions(bool enable)
void ChatWindow::onFileTransferTriggered()
{
- /// TODO
+ // This feature should be used only in 1on1 chats!
+ ChatWidget *currChat = qobject_cast<ChatWidget*>(m_tabWidget->currentWidget());
+
+ // This should never happen
+ if (!currChat) {
+ return;
+ }
+
+ startFileTransfer(currChat->account(), currChat->textChannel()->targetContact());
}
void ChatWindow::onFindNextText()
@@ -222,6 +244,15 @@ void ChatWindow::onFindPreviousText()
currChat->chatSearchBar()->onPreviousButtonClicked();
}
+void ChatWindow::onGenericOperationFinished(Tp::PendingOperation* op)
+{
+ // send notification via plasma like the contactlist does
+ if (op->isError()) {
+ QString errorMsg(op->errorName() + ": " + op->errorMessage());
+ sendNotificationToUser(SystemErrorMessage, errorMsg);
+ }
+}
+
void ChatWindow::onInviteToChatTriggered()
{
/// TODO
@@ -289,7 +320,14 @@ void ChatWindow::onTabTextChanged(const QString &newTitle)
void ChatWindow::onVideoCallTriggered()
{
- /// TODO
+ ChatWidget *currChat = qobject_cast<ChatWidget*>(m_tabWidget->currentWidget());
+
+ // This should never happen
+ if (!currChat) {
+ return;
+ }
+
+ startVideoCall(currChat->account(), currChat->textChannel()->targetContact());
}
void ChatWindow::showSettingsDialog()
@@ -325,6 +363,21 @@ void ChatWindow::createNewChat(const Tp::TextChannelPtr &channelPtr, const Tp::A
}
}
+void ChatWindow::sendNotificationToUser(ChatWindow::NotificationType type, const QString& errorMsg)
+{
+ //The pointer is automatically deleted when the event is closed
+ KNotification *notification;
+
+ if (type == SystemInfoMessage) {
+ notification = new KNotification("telepathyInfo", this);
+ } else {
+ notification = new KNotification("telepathyError", this);
+ }
+
+ notification->setText(errorMsg);
+ notification->sendEvent();
+}
+
void ChatWindow::setupChatTabSignals(ChatTab *chatTab)
{
connect(chatTab, SIGNAL(titleChanged(QString)), this, SLOT(onTabTextChanged(QString)));
@@ -370,4 +423,56 @@ void ChatWindow::setupCustomActions()
actionCollection()->addAction("invite-to-chat", inviteToChat);
}
+void ChatWindow::startAudioCall(const Tp::AccountPtr& account, const Tp::ContactPtr& contact)
+{
+ Tp::PendingChannelRequest* channelRequest = account->ensureStreamedMediaAudioCall(contact,
+ QDateTime::currentDateTime(),
+ PREFERRED_AUDIO_VIDEO_HANDLER);
+ connect(channelRequest, SIGNAL(finished(Tp::PendingOperation*)), this, SLOT(onGenericOperationFinished(Tp::PendingOperation*)));
+}
+
+void ChatWindow::startFileTransfer(const Tp::AccountPtr& account, const Tp::ContactPtr& contact)
+{
+ // check for existance of ContactPtr
+ Q_ASSERT(contact);
+
+ // use the keyword "KdeTelepathyFileTransfer" for setting last used dir for file transfer
+ QString fileName = KFileDialog::getOpenFileName(KUrl("kfiledialog:///FileTransferLastDirectory"),
+ QString(),
+ this,
+ i18n("Choose a file"));
+
+ // User hit cancel button
+ if (fileName.isEmpty()) {
+ return;
+ }
+
+ QFileInfo fileinfo(fileName);
+
+ kDebug() << "Filename:" << fileName;
+ kDebug() << "Content type:" << KMimeType::findByFileContent(fileName)->name();
+ // TODO Let the user set a description?
+
+ Tp::FileTransferChannelCreationProperties fileTransferProperties(fileName, KMimeType::findByFileContent(fileName)->name());
+
+ Tp::PendingChannelRequest* channelRequest = account->createFileTransfer(contact,
+ fileTransferProperties,
+ QDateTime::currentDateTime(),
+ PREFERRED_FILETRANSFER_HANDLER);
+
+ connect(channelRequest, SIGNAL(finished(Tp::PendingOperation*)), SLOT(onGenericOperationFinished(Tp::PendingOperation*)));
+}
+
+void ChatWindow::startVideoCall(const Tp::AccountPtr& account, const Tp::ContactPtr& contact)
+{
+ Tp::PendingChannelRequest* channelRequest = account->ensureStreamedMediaVideoCall(contact,
+ true,
+ QDateTime::currentDateTime(),
+ PREFERRED_AUDIO_VIDEO_HANDLER);
+ connect(channelRequest, SIGNAL(finished(Tp::PendingOperation*)), this, SLOT(onGenericOperationFinished(Tp::PendingOperation*)));
+}
+
+
+
+
#include "chat-window.moc"
diff --git a/app/chat-window.h b/app/chat-window.h
index 3db916e..661cbea 100644
--- a/app/chat-window.h
+++ b/app/chat-window.h
@@ -36,6 +36,11 @@ public:
ChatWindow();
virtual ~ChatWindow();
+ enum NotificationType {
+ SystemErrorMessage,
+ SystemInfoMessage
+ };
+
/**
* starts a new chat with the textChannelPtr given only if the
* chat doesn't already exist
@@ -52,20 +57,21 @@ public slots:
private slots:
void closeCurrentTab();
- void onAudioCallTriggered(); /** start an audio call */
+ void onAudioCallTriggered(); /** start an audio call */
void onCurrentIndexChanged(int index);
- void onEnableSearchActions(bool enable); /** enables/disables menu search actions */
- void onFileTransferTriggered(); /** start a file transfer */
- void onFindNextText(); /** go to next text the user is searching for */
- void onFindPreviousText(); /** go to previous text the user is searching for */
- void onInviteToChatTriggered(); /** invite contact(s) to chat */
- void onNextTabActionTriggered(); /** go to next tab in the tabwidget */
- void onPreviousTabActionTriggered(); /** go to previous tab in the tabwidget */
- void onSearchActionToggled(); /** toggle search bar visibility */
+ void onEnableSearchActions(bool enable); /** enables/disables menu search actions */
+ void onFileTransferTriggered(); /** start a file transfer (to be used only for 1on1 chats!) */
+ void onFindNextText(); /** go to next text the user is searching for */
+ void onFindPreviousText(); /** go to previous text the user is searching for */
+ void onGenericOperationFinished(Tp::PendingOperation *op);
+ void onInviteToChatTriggered(); /** invite contact(s) to chat */
+ void onNextTabActionTriggered(); /** go to next tab in the tabwidget */
+ void onPreviousTabActionTriggered(); /** go to previous tab in the tabwidget */
+ void onSearchActionToggled(); /** toggle search bar visibility */
void onTabStateChanged();
void onTabTextChanged(const QString &newTitle);
void onTabIconChanged(const KIcon &newIcon);
- void onVideoCallTriggered(); /** start a video call */
+ void onVideoCallTriggered(); /** start a video call */
protected slots:
void showSettingsDialog();
@@ -77,6 +83,12 @@ private:
*/
void createNewChat(const Tp::TextChannelPtr &channelPtr, const Tp::AccountPtr &account);
+ /** sends notification to the user via plasma desktop notification system
+ * @param type notification type
+ * @param errorMsg message to display
+ */
+ void sendNotificationToUser(NotificationType type, const QString &errorMsg);
+
/** connects the neccessary chat tab signals with slots in chatwindow
* @param chatTab chatTab object to connect
*/
@@ -85,6 +97,24 @@ private:
/** creates and adds custom actions for the chat window */
void setupCustomActions();
+ /** starts audio call with given contact
+ * @param account account sending the audio call request
+ * @param contact contact with whom to start audio call
+ */
+ void startAudioCall(const Tp::AccountPtr &account, const Tp::ContactPtr &contact);
+
+ /** starts file transfer
+ * @param account account starting the file transfer
+ * @param contact contact with whom to start file transfer
+ */
+ void startFileTransfer(const Tp::AccountPtr &account, const Tp::ContactPtr &contact);
+
+ /** starts a video call with given contact
+ * @param account account starting the file transfer
+ * @param contact contact with whom to start file transfer
+ */
+ void startVideoCall(const Tp::AccountPtr &account, const Tp::ContactPtr &contact);
+
KTabWidget *m_tabWidget;
};
diff --git a/app/telepathy-kde-text-ui.notifyrc b/app/telepathy-kde-text-ui.notifyrc
new file mode 100644
index 0000000..ceb1bb3
--- /dev/null
+++ b/app/telepathy-kde-text-ui.notifyrc
@@ -0,0 +1,53 @@
+[Global]
+Name=Instant messaging
+Name[nl]=Instant Messaging
+Name[pt]=Mensagem instantânea
+Name[pt_BR]=Mensagens instantâneas
+Name[sv]=Direktmeddelanden
+Name[uk]=Миттєвий обмін повідомленнями
+Name[x-test]=xxInstant messagingxx
+Comment=Instant messaging
+Comment[nl]=Instant Messaging
+Comment[pt]=Mensagem instantânea
+Comment[pt_BR]=Mensagens instantâneas
+Comment[sv]=Direktmeddelanden
+Comment[uk]=Миттєвий обмін повідомленнями
+Comment[x-test]=xxInstant messagingxx
+
+[Event/telepathyError]
+IconName=dialog-error
+Name=Instant messaging error
+Name[nl]=Fout met Instant Messaging
+Name[pt]=Erro das Mensagens Instantâneas
+Name[pt_BR]=Erro das mensagens instantâneas
+Name[sv]=Fel för direktmeddelanden
+Name[uk]=Помилка системи обміну повідомленнями
+Name[x-test]=xxInstant messaging errorxx
+Comment=An error occurred within instant messaging
+Comment[nl]=Er is een fout opgetreden met Instant Messaging
+Comment[pt]=Ocorreu um erro nas mensagens instantâneas
+Comment[pt_BR]=Ocorreu um erro nas mensagens instantâneas
+Comment[sv]=Ett fel uppstod med direktmeddelanden
+Comment[uk]=У системі обміну повідомленнями сталася помилка
+Comment[x-test]=xxAn error occurred within instant messagingxx
+Sound=KDE-Im-Cant-Connect.ogg
+Action=Popup|Sound
+
+[Event/telepathyInfo]
+IconName=dialog-information
+Name=Instant messaging info message
+Name[nl]=Informatiemelding van Instant Messaging
+Name[pt]=Mensagem informativa instantânea
+Name[pt_BR]=Mensagem informativa instantânea
+Name[sv]=Information från direktmeddelanden
+Name[uk]=Повідомлення системи обміну повідомленнями
+Name[x-test]=xxInstant messaging info messagexx
+Comment=A general info message from instant messaging
+Comment[nl]=Een algemene informatiemelding uit Instant Messaging
+Comment[pt]=Uma mensagem informativa geral das mensagens instantâneas
+Comment[pt_BR]=Uma mensagem informativa geral das mensagens instantâneas
+Comment[sv]=Allmän information från direktmeddelanden
+Comment[uk]=Загальне повідомлення системи обміну повідомленнями
+Comment[x-test]=xxA general info message from instant messagingxx
+Sound=KDE-Im-Low-Priority-Message.ogg
+Action=Popup|Sound
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list