PsiTrayIcon::PsiTrayIcon(const QString &tip, QMenu *popup, QObject *parent) : QObject(parent) { icon_ = NULL; trayicon_ = NULL; trayicon_ = new QSystemTrayIcon(); trayicon_->setContextMenu(popup); setToolTip(tip); connect(trayicon_,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),SLOT(trayicon_activated(QSystemTrayIcon::ActivationReason))); // } }
/** \class MainWindows \brief Main Window for QtSmbstatus Client et Light \date 2008-11-16 \version 2.1 \author Daniel Rocher */ MainWindows::MainWindows(QWidget *parent) : QMainWindow(parent) { debugQt("MainWindows::MainWindows()"); setupUi(this); if (check_new_release) checkForUpdateOfQtSmbstatus(); msgError=new QErrorMessage(this); // an error message display dialog trayicon =new QSystemTrayIcon(QIcon (":/icons/qtsmbstatus.png"),this); menuApp=new QMenu( this ); viewlog_action=menuApp->addAction ( tr("Show CIFS/SMB activities") ); connect(viewlog_action,SIGNAL( triggered ()),this , SLOT(on_action_View_log_triggered())); configure_action= menuApp->addAction ( QIcon (":/icons/configure.png"),tr("Configure") ); connect(configure_action,SIGNAL( triggered ()),this , SLOT(on_configureAction_triggered())); menuApp->addSeparator (); restore_action=menuApp->addAction (tr("Minimize") ); connect(restore_action,SIGNAL( triggered ()),this , SLOT(restore_minimize())); QAction * exit_action=menuApp->addAction ( QIcon (":/icons/exit.png"),tr("Quit") ); connect(exit_action,SIGNAL( triggered ()),this , SLOT(beforeQuit () )); connect(action_Quit,SIGNAL( triggered ()),this , SLOT(beforeQuit () )); trayicon->setContextMenu ( menuApp ); connect(trayicon,SIGNAL(activated ( QSystemTrayIcon::ActivationReason ) ),this,SLOT(trayicon_activated(QSystemTrayIcon::ActivationReason))); restoreWindowSize(); // create statusBar statusBar()->showMessage (""); //status bar smbstatus_rq_started=false; // treeWidget treeWidget->setSortingEnabled ( true ); treeWidget->setRootIsDecorated ( false ); treeWidget->setHeaderLabel ( ""); treeWidget->setContextMenuPolicy (Qt::CustomContextMenu ); // create popup menu menuPopup = new QMenu( treeWidget ); connect(treeWidget, SIGNAL( customContextMenuRequested ( const QPoint & ) ), this, SLOT( slotPopupMenu( const QPoint & ) ) ); // first time configuration_changed(); // form view CIFS/SMB activities logform = new LogForm(this); connect(this ,SIGNAL(refreshviewlog(const type_message &)), logform,SLOT(append(const type_message &))); connect(&timerinfoSmb, SIGNAL(timeout()), this, SLOT(InfoSMB())); connect(&timerSmbRequest, SIGNAL(timeout()), this, SLOT(slot_timer())); }