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
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@ Installation Instructions
*************************
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
unlimited permission to copy, distribute and modify it.
......@@ -159,7 +159,7 @@ Particular systems
CC is not installed, it is recommended to use the following options in
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.
......@@ -174,6 +174,16 @@ and if that doesn't work, try
./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
==========================
......@@ -189,7 +199,8 @@ type, such as `sun4', or a canonical name which has the form:
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
`config.sub' isn't included in this package, then this package doesn't
......
......@@ -57,44 +57,56 @@ bool SFLPhone::initialize()
return false;
}
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
// accept dnd
setAcceptDrops(true);
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
// accept dnd
setAcceptDrops(true);
// tell the KXmlGuiWindow that this is indeed the main widget
setCentralWidget(view);
// tell the KXmlGuiWindow that this is indeed the main widget
setCentralWidget(view);
setWindowIcon(QIcon(ICON_SFLPHONE));
setWindowTitle(i18n("SFLphone"));
setWindowIcon(QIcon(ICON_SFLPHONE));
setWindowTitle(i18n("SFLphone"));
setupActions();
setupActions();
setObjectNames();
QMetaObject::connectSlotsByName(this);
view->on_stackedWidget_screen_currentChanged(SCREEN_MAIN);
view->loadWindow();
statusBarWidget = new QLabel();
statusBar()->addWidget(statusBarWidget);
trayIconMenu = new QMenu(this);
trayIconMenu->addAction(action_quit);
move(QCursor::pos().x() - geometry().width()/2, QCursor::pos().y() - geometry().height()/2);
if( ! configurationManager.isStartHidden())
{
show();
}
trayIcon = new KSystemTrayIcon(this->windowIcon(), this);
trayIcon->setContextMenu(trayIconMenu);
if(configurationManager.getAccountList().value().isEmpty())
{
(new AccountWizard())->show();
}
trayIcon->show();
iconChanged = false;
return true;
setObjectNames();
QMetaObject::connectSlotsByName(this);
view->on_stackedWidget_screen_currentChanged(SCREEN_MAIN);
view->loadWindow();
move(QCursor::pos().x() - geometry().width()/2, QCursor::pos().y() - geometry().height()/2);
if( ! configurationManager.isStartHidden())
{
show();
}
if(configurationManager.getAccountList().value().isEmpty())
{
(new AccountWizard())->show();
}
return true;
}
void SFLPhone::setObjectNames()
{
view->setObjectName("view");
statusBar()->setObjectName("statusBar");
trayIcon->setObjectName("trayIcon");
trayIcon->setObjectName("trayIcon");
}
void SFLPhone::setupActions()
......@@ -166,19 +178,6 @@ void SFLPhone::setupActions()
actionCollection()->addAction("action_configureSflPhone", action_configureSflPhone);
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";
if(! QFile::exists(rcFilePath))
{
......@@ -240,37 +239,13 @@ void SFLPhone::trayIconSignal()
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->setText("messageText") ;
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" ) ;
// connect(notification, SIGNAL(activated(unsigned int )), this , SLOT(sendNotif()) );
qDebug() << notification->contexts();
qDebug() << notification->eventId();
connect(notification, SIGNAL(activated(unsigned int )), this , SLOT(sendNotif()) );
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()
......@@ -283,7 +258,6 @@ void SFLPhone::changeEvent(QEvent * event)
{
if (event->type() == QEvent::ActivationChange && iconChanged && isActiveWindow())
{
trayIcon->setIcon(this->windowIcon());
iconChanged = false;
}
}
......
......@@ -5,6 +5,7 @@
#include <KIconLoader>
#include <KStandardDirs>
#include <KNotification>
#include <KSystemTrayIcon>
#include <KMainWindow>
#include "SFLPhone.h"
......@@ -26,11 +27,6 @@ SFLPhoneApplication::SFLPhoneApplication()
// Start remaining initialisation
initializePaths();
initializeMainWindow();
// test notif
KNotification *notification = new KNotification( "contact online" );
notification->setText( "text" );
notification->sendEvent();
}
......@@ -91,19 +87,6 @@ void SFLPhoneApplication::initializeMainWindow()
// Initialize KApplication
//setTopWidget( sflphoneWindow_ );
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()
void SFLPhoneApplication::initializePaths()
{
// Add compile time paths as fallback
KGlobal::dirs() -> addPrefix( QString("/home/mlhamel/Documents/sflphone/sflphone-client-kde/data/") );
KIconLoader::global() -> addAppDir( QString("/home/mlhamel/Documents/sflphone/sflphone-client-kde/data/") );
KGlobal::dirs() -> addPrefix( QString(DATA_INSTALL_DIR) );
KIconLoader::global() -> addAppDir( QString(DATA_INSTALL_DIR) + "/share" );
qDebug() << "KGlobal::dirs" << QString(DATA_INSTALL_DIR);
// Test whether the prefix is correct.
if( KGlobal::dirs()->findResource( "appdata", "icons/hi128-apps-sflphone-client-kde.png" ).isNull() )
{
......
......@@ -46,7 +46,6 @@ int main(int argc, char **argv)
about.setTranslator( ki18nc("NAME OF TRANSLATORS","Your names"), ki18nc("EMAIL OF TRANSLATORS","Your emails") );
KCmdLineArgs::init(argc, argv, &about);
KCmdLineOptions options;
//options.add("+[URL]", ki18n( "Document to open" ));
KCmdLineArgs::addCmdLineOptions(options);
//configuration dbus
......@@ -57,10 +56,6 @@ int main(int argc, char **argv)
SFLPhoneApplication app;
KNotification *notification = new KNotification( "contact online" );
notification->setText( "text" );
notification->sendEvent();
return app.exec();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment