Skip to content
Snippets Groups Projects
Commit 23e707fb authored by Mathieu Leduc-Hamel's avatar Mathieu Leduc-Hamel
Browse files

[#2701] Fix trayicon init and path used by the kapplication when creating it

parent a6bfa00e
Branches
Tags
No related merge requests found
...@@ -2,7 +2,7 @@ Installation Instructions ...@@ -2,7 +2,7 @@ Installation Instructions
************************* *************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006, 2007, 2008 Free Software Foundation, Inc. 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it. unlimited permission to copy, distribute and modify it.
...@@ -159,7 +159,7 @@ Particular systems ...@@ -159,7 +159,7 @@ Particular systems
CC is not installed, it is recommended to use the following options in CC is not installed, it is recommended to use the following options in
order to use an ANSI C compiler: order to use an ANSI C compiler:
./configure CC="cc -Ae" ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
and if that doesn't work, install pre-built binaries of GCC for HP-UX. and if that doesn't work, install pre-built binaries of GCC for HP-UX.
...@@ -174,6 +174,16 @@ and if that doesn't work, try ...@@ -174,6 +174,16 @@ and if that doesn't work, try
./configure CC="cc -nodtk" ./configure CC="cc -nodtk"
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
directory contains several dysfunctional programs; working variants of
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
in your `PATH', put it _after_ `/usr/bin'.
On Haiku, software installed for all users goes in `/boot/common',
not `/usr/local'. It is recommended to use the following options:
./configure --prefix=/boot/common
Specifying the System Type Specifying the System Type
========================== ==========================
...@@ -189,7 +199,8 @@ type, such as `sun4', or a canonical name which has the form: ...@@ -189,7 +199,8 @@ type, such as `sun4', or a canonical name which has the form:
where SYSTEM can have one of these forms: where SYSTEM can have one of these forms:
OS KERNEL-OS OS
KERNEL-OS
See the file `config.sub' for the possible values of each field. If See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't `config.sub' isn't included in this package, then this package doesn't
......
...@@ -69,12 +69,24 @@ ConfigurationManagerInterface & configurationManager = ConfigurationManagerInter ...@@ -69,12 +69,24 @@ ConfigurationManagerInterface & configurationManager = ConfigurationManagerInter
setupActions(); setupActions();
statusBarWidget = new QLabel();
statusBar()->addWidget(statusBarWidget);
trayIconMenu = new QMenu(this);
trayIconMenu->addAction(action_quit);
trayIcon = new KSystemTrayIcon(this->windowIcon(), this);
trayIcon->setContextMenu(trayIconMenu);
trayIcon->show();
iconChanged = false;
setObjectNames(); setObjectNames();
QMetaObject::connectSlotsByName(this); QMetaObject::connectSlotsByName(this);
view->on_stackedWidget_screen_currentChanged(SCREEN_MAIN); view->on_stackedWidget_screen_currentChanged(SCREEN_MAIN);
view->loadWindow(); view->loadWindow();
move(QCursor::pos().x() - geometry().width()/2, QCursor::pos().y() - geometry().height()/2); move(QCursor::pos().x() - geometry().width()/2, QCursor::pos().y() - geometry().height()/2);
if( ! configurationManager.isStartHidden()) if( ! configurationManager.isStartHidden())
{ {
...@@ -166,19 +178,6 @@ void SFLPhone::setupActions() ...@@ -166,19 +178,6 @@ void SFLPhone::setupActions()
actionCollection()->addAction("action_configureSflPhone", action_configureSflPhone); actionCollection()->addAction("action_configureSflPhone", action_configureSflPhone);
actionCollection()->addAction("action_accountCreationWizard", action_accountCreationWizard); actionCollection()->addAction("action_accountCreationWizard", action_accountCreationWizard);
statusBarWidget = new QLabel();
statusBar()->addWidget(statusBarWidget);
trayIconMenu = new QMenu(this);
trayIconMenu->addAction(action_quit);
trayIcon = new KSystemTrayIcon(this->windowIcon(), this);
trayIcon->setContextMenu(trayIconMenu);
trayIcon->show();
iconChanged = false;
QString rcFilePath = QString(DATA_INSTALL_DIR) + "/sflphone-client-kde/sflphone-client-kdeui.rc"; QString rcFilePath = QString(DATA_INSTALL_DIR) + "/sflphone-client-kde/sflphone-client-kdeui.rc";
if(! QFile::exists(rcFilePath)) if(! QFile::exists(rcFilePath))
{ {
...@@ -240,37 +239,13 @@ void SFLPhone::trayIconSignal() ...@@ -240,37 +239,13 @@ void SFLPhone::trayIconSignal()
void SFLPhone::sendNotif(QString caller) void SFLPhone::sendNotif(QString caller)
{ {
KComponentData m_instance = KGlobal::mainComponent();
KNotification::event("test_notification2", i18n("Feeds added:\n %1", "message"), QPixmap() , this, KNotification::CloseOnTimeout, m_instance);
//--------------------------------
KNotification::event( "test_notification2",
QString("summary"),
QPixmap(),
topLevelWidget());
KNotification::beep();
//--------------------------------
notification = new KNotification ( QString("test_notification2"), 0l );
notification->setActions( QStringList( i18n( "View" ) ) );
notification->setText(QString("messageText"));
notification->sendEvent();
//--------------------------------
notification = new KNotification ( QString("test_notification"), this ); notification = new KNotification ( QString("test_notification"), this );
notification->setText("messageText") ; notification->setText("messageText") ;
notification->setPixmap( QPixmap( this->windowIcon().pixmap(32, 32) )); notification->setPixmap( QPixmap( this->windowIcon().pixmap(32, 32) ));
// notification->setActions( QStringList( i18n( "Open chat" ) ) ); notification->setActions( QStringList( i18n( "Open chat" ) ) );
notification->addContext( QString::fromLatin1("call") , "caller" ) ; notification->addContext( QString::fromLatin1("call") , "caller" ) ;
// connect(notification, SIGNAL(activated(unsigned int )), this , SLOT(sendNotif()) ); connect(notification, SIGNAL(activated(unsigned int )), this , SLOT(sendNotif()) );
qDebug() << notification->contexts();
qDebug() << notification->eventId();
notification->sendEvent(); notification->sendEvent();
//--------------------------------
trayIcon->showMessage(
i18n("Incoming call"),
i18n("You have an incoming call from") + " " + caller + ".\n" + i18n("Click to accept or refuse it."),
KSystemTrayIcon::Warning,
20000);
} }
void SFLPhone::on_trayIcon_messageClicked() void SFLPhone::on_trayIcon_messageClicked()
...@@ -283,7 +258,6 @@ void SFLPhone::changeEvent(QEvent * event) ...@@ -283,7 +258,6 @@ void SFLPhone::changeEvent(QEvent * event)
{ {
if (event->type() == QEvent::ActivationChange && iconChanged && isActiveWindow()) if (event->type() == QEvent::ActivationChange && iconChanged && isActiveWindow())
{ {
trayIcon->setIcon(this->windowIcon());
iconChanged = false; iconChanged = false;
} }
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <KIconLoader> #include <KIconLoader>
#include <KStandardDirs> #include <KStandardDirs>
#include <KNotification> #include <KNotification>
#include <KSystemTrayIcon>
#include <KMainWindow> #include <KMainWindow>
#include "SFLPhone.h" #include "SFLPhone.h"
...@@ -26,11 +27,6 @@ SFLPhoneApplication::SFLPhoneApplication() ...@@ -26,11 +27,6 @@ SFLPhoneApplication::SFLPhoneApplication()
// Start remaining initialisation // Start remaining initialisation
initializePaths(); initializePaths();
initializeMainWindow(); initializeMainWindow();
// test notif
KNotification *notification = new KNotification( "contact online" );
notification->setText( "text" );
notification->sendEvent();
} }
...@@ -91,19 +87,6 @@ void SFLPhoneApplication::initializeMainWindow() ...@@ -91,19 +87,6 @@ void SFLPhoneApplication::initializeMainWindow()
// Initialize KApplication // Initialize KApplication
//setTopWidget( sflphoneWindow_ ); //setTopWidget( sflphoneWindow_ );
sflphoneWindow_->show(); sflphoneWindow_->show();
// We found session data for the Contact List, to restore it
/*if( kapp->isSessionRestored() && restoredWindow != -1 )
{
sflphoneWindow_->restore( restoredWindow, false );
}
else
{
if( ! args->isSet( "hidden" ) )
{
sflphoneWindow_->show();
}
}*/
} }
...@@ -114,10 +97,11 @@ void SFLPhoneApplication::initializeMainWindow() ...@@ -114,10 +97,11 @@ void SFLPhoneApplication::initializeMainWindow()
void SFLPhoneApplication::initializePaths() void SFLPhoneApplication::initializePaths()
{ {
// Add compile time paths as fallback // Add compile time paths as fallback
KGlobal::dirs() -> addPrefix( QString("/home/mlhamel/Documents/sflphone/sflphone-client-kde/data/") ); KGlobal::dirs() -> addPrefix( QString(DATA_INSTALL_DIR) );
KIconLoader::global() -> addAppDir( QString("/home/mlhamel/Documents/sflphone/sflphone-client-kde/data/") ); KIconLoader::global() -> addAppDir( QString(DATA_INSTALL_DIR) + "/share" );
qDebug() << "KGlobal::dirs" << QString(DATA_INSTALL_DIR); qDebug() << "KGlobal::dirs" << QString(DATA_INSTALL_DIR);
// Test whether the prefix is correct. // Test whether the prefix is correct.
if( KGlobal::dirs()->findResource( "appdata", "icons/hi128-apps-sflphone-client-kde.png" ).isNull() ) if( KGlobal::dirs()->findResource( "appdata", "icons/hi128-apps-sflphone-client-kde.png" ).isNull() )
{ {
......
...@@ -46,7 +46,6 @@ int main(int argc, char **argv) ...@@ -46,7 +46,6 @@ int main(int argc, char **argv)
about.setTranslator( ki18nc("NAME OF TRANSLATORS","Your names"), ki18nc("EMAIL OF TRANSLATORS","Your emails") ); about.setTranslator( ki18nc("NAME OF TRANSLATORS","Your names"), ki18nc("EMAIL OF TRANSLATORS","Your emails") );
KCmdLineArgs::init(argc, argv, &about); KCmdLineArgs::init(argc, argv, &about);
KCmdLineOptions options; KCmdLineOptions options;
//options.add("+[URL]", ki18n( "Document to open" ));
KCmdLineArgs::addCmdLineOptions(options); KCmdLineArgs::addCmdLineOptions(options);
//configuration dbus //configuration dbus
...@@ -57,10 +56,6 @@ int main(int argc, char **argv) ...@@ -57,10 +56,6 @@ int main(int argc, char **argv)
SFLPhoneApplication app; SFLPhoneApplication app;
KNotification *notification = new KNotification( "contact online" );
notification->setText( "text" );
notification->sendEvent();
return app.exec(); return app.exec();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment