extended gntp with app icon

This commit is contained in:
Patrick von Reth 2011-07-24 12:28:44 +02:00
parent f558e1420a
commit 7e34fbaecf
5 changed files with 9 additions and 7 deletions

View File

@ -40,11 +40,9 @@ public:
SnoreIconData(const QString &url){ SnoreIconData(const QString &url){
if(url.startsWith(":/")){ if(url.startsWith(":/")){
qDebug()<<url<<"is resource";
_img = QImage(url); _img = QImage(url);
_isLocalFile = false; _isLocalFile = false;
}else if(QFile(url).exists()){ }else if(QFile(url).exists()){
qDebug()<<url<<"is local File icon";
_isLocalFile = true; _isLocalFile = true;
_localFileName = url; _localFileName = url;
} }

View File

@ -27,7 +27,7 @@
QString const SnoreServer::version(){ QString const SnoreServer::version(){
return "0.1.5"; return "0.15";
} }
QString const SnoreServer::snoreTMP(){ QString const SnoreServer::snoreTMP(){

View File

@ -51,7 +51,7 @@ void FreedesktopNotification_Frontend::actionInvoked(Notification notification)
void FreedesktopNotification_Frontend::notificationClosed(Notification notification) { void FreedesktopNotification_Frontend::notificationClosed(Notification notification) {
qDebug()<<"Closing Dbus notification"<<notification.id()<<"reason:"<<(int)notification.closeReason(); qDebug()<<"Closing Dbus notification"<<notification.id()<<"reason:"<<(int)notification.closeReason();
activeNotifications.take(notification.id()); activeNotifications.remove(notification.id());
emit NotificationClosed(notification.id(),notification.closeReason()); emit NotificationClosed(notification.id(),notification.closeReason());
} }

View File

@ -163,18 +163,21 @@ private:
std::string hostname_; std::string hostname_;
std::string port_; std::string port_;
std::string password_; std::string password_;
std::string icon_;
CryptoPP::AutoSeededRandomPool rng; CryptoPP::AutoSeededRandomPool rng;
public: public:
gntp(std::string application = "gntp-send", std::string password = "", gntp(std::string application = "gntp-send", std::string icon = "" ,std::string password = "",
std::string hostname = "localhost", std::string port = "23053") : std::string hostname = "localhost", std::string port = "23053") :
application_(application), application_(application),
password_(password), password_(password),
hostname_(hostname), hostname_(hostname),
port_(port) { } port_(port),
icon_(icon){ }
void regist(const char* name) throw (std::runtime_error) { void regist(const char* name) throw (std::runtime_error) {
std::stringstream stm; std::stringstream stm;
stm << "Application-Name: " << sanitize_text(application_) << "\r\n"; stm << "Application-Name: " << sanitize_text(application_) << "\r\n";
stm << "Application-Icon: " << sanitize_text(icon_) <<"\r\n";
stm << "Notifications-Count: 1\r\n"; stm << "Notifications-Count: 1\r\n";
stm << "\r\n"; stm << "\r\n";
make_regist(stm, name); make_regist(stm, name);
@ -185,6 +188,7 @@ public:
void regist(const char* name) throw (std::runtime_error) { void regist(const char* name) throw (std::runtime_error) {
std::stringstream stm; std::stringstream stm;
stm << "Application-Name: " << sanitize_text(application_) << "\r\n"; stm << "Application-Name: " << sanitize_text(application_) << "\r\n";
stm << "Application-Icon: " << sanitize_text(icon_) <<"\r\n";
stm << "Notifications-Count: 1\r\n"; stm << "Notifications-Count: 1\r\n";
stm << "\r\n"; stm << "\r\n";
make_regist(stm, name); make_regist(stm, name);

View File

@ -38,7 +38,7 @@ Growl_Backend::~Growl_Backend(){
} }
void Growl_Backend::registerApplication(Application *application){ void Growl_Backend::registerApplication(Application *application){
gntp *growl = new gntp(application->name().toUtf8().constData()); gntp *growl = new gntp(application->name().toUtf8().constData(),application->icon().localUrl().toUtf8().constData());
foreach(Alert *a,application->alerts()){ foreach(Alert *a,application->alerts()){
try{ try{
growl->regist(a->name().toUtf8().constData()); growl->regist(a->name().toUtf8().constData());