60 |
60 |
#include "global.h"
|
61 |
61 |
#include "qtuistyle.h"
|
62 |
62 |
|
|
63 |
#include <Qt/QtDBus>
|
|
64 |
|
63 |
65 |
|
64 |
66 |
MainWin::MainWin(QtUi *_gui, QWidget *parent)
|
65 |
67 |
: QMainWindow(parent),
|
... | ... | |
218 |
220 |
actionData = action->data();
|
219 |
221 |
if(!actionData.isValid())
|
220 |
222 |
continue;
|
221 |
|
|
|
223 |
|
222 |
224 |
if(actionData.toString() == "__EOBV__")
|
223 |
225 |
break;
|
224 |
226 |
|
... | ... | |
404 |
406 |
connect(Client::bufferViewManager(), SIGNAL(bufferViewConfigAdded(int)), this, SLOT(addBufferView(int)));
|
405 |
407 |
connect(Client::bufferViewManager(), SIGNAL(bufferViewConfigDeleted(int)), this, SLOT(removeBufferView(int)));
|
406 |
408 |
connect(Client::bufferViewManager(), SIGNAL(initDone()), this, SLOT(loadLayout()));
|
407 |
|
|
|
409 |
|
408 |
410 |
foreach(BufferInfo id, Client::allBufferInfos()) {
|
409 |
411 |
Client::backlogManager()->requestBacklog(id.bufferId(), 500, -1);
|
410 |
412 |
}
|
... | ... | |
454 |
456 |
actionData = action->data();
|
455 |
457 |
if(!actionData.isValid())
|
456 |
458 |
continue;
|
457 |
|
|
|
459 |
|
458 |
460 |
if(actionData.toString() == "__EOBV__")
|
459 |
461 |
break;
|
460 |
462 |
|
... | ... | |
572 |
574 |
// FIXME don't invoke style engine for this!
|
573 |
575 |
QString text = QtUi::style()->styleString(Message::mircToInternal(msg.contents())).plainText;
|
574 |
576 |
displayTrayIconMessage(title, text);
|
|
577 |
sendDesktopNotification(title, text);
|
575 |
578 |
}
|
576 |
579 |
#endif
|
577 |
580 |
if(uiSettings.value("AnimateTrayIcon", QVariant(true)).toBool()) {
|
... | ... | |
587 |
590 |
return QMainWindow::event(event);
|
588 |
591 |
}
|
589 |
592 |
|
|
593 |
|
|
594 |
/*
|
|
595 |
Using the notification-daemon from Freedesktop's Galago project
|
|
596 |
http://www.galago-project.org/specs/notification/0.9/x408.html#command-notify
|
|
597 |
*/
|
|
598 |
void MainWin::sendDesktopNotification(const QString &title, const QString &message)
|
|
599 |
{
|
|
600 |
QStringList actions;
|
|
601 |
QMap<QString, QVariant> hints;
|
|
602 |
QDBusMessage msg = QDBusMessage::createMethodCall("org.freedesktop.Notifications", "/org/freedesktop/Notifications", "", "Notify");
|
|
603 |
|
|
604 |
hints["x"] = 100; // Standard hint: x location for the popup to show up
|
|
605 |
hints["y"] = 100; // Standard hint: y location for the popup to show up
|
|
606 |
|
|
607 |
msg << "Quassel"; // Application name
|
|
608 |
msg << quint32(0); // ID of previous notification to replace
|
|
609 |
msg << ""; // Icon to display
|
|
610 |
msg << "Quassel: " + title; // Summary / Header of the message to display
|
|
611 |
msg << message; // Body of the message to display
|
|
612 |
msg << actions; // Actions from which the user may choose
|
|
613 |
msg << hints; // Hints to the server displaying the message
|
|
614 |
msg << qint32(10000); // Timeout in milliseconds
|
|
615 |
|
|
616 |
(void)QDBusConnection::sessionBus().call(msg); // Would return a message containing the id of this notification
|
|
617 |
}
|
|
618 |
|
|
619 |
|
590 |
620 |
void MainWin::displayTrayIconMessage(const QString &title, const QString &message) {
|
591 |
621 |
systray->showMessage(title, message);
|
592 |
622 |
}
|