/* \brief For catch an action on the systray icon \param reason Why it activated */ void SystrayIcon::CatchAction(QSystemTrayIcon::ActivationReason reason) { if(reason==QSystemTrayIcon::DoubleClick || reason==QSystemTrayIcon::Trigger) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Double click on system tray icon"); if(stateListener!=Ultracopier::NotListening) emit tryUncatchCopy(); else { if(!haveListener) { showTryCatchMessageWithNoListener(); return; } emit tryCatchCopy(); } } else if(reason==QSystemTrayIcon::Context)//do nothing on right click to show as auto the menu ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QString("The action on the systray icon is unknown: %1").arg(reason)); else { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,QString("The action on the systray icon is unknown: %1").arg(reason)); QMessageBox::warning(NULL,tr("Warning"),tr("The action on the systray icon is unknown!")); } }
/// \brief Called when event loop is setup void EventDispatcher::initFunction() { if(core==NULL || copyEngineList==NULL) { ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Critical,"Unable to initialize correctly the software"); return; } ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"Initialize the variable of event loop"); connect(copyServer, SIGNAL(newCopy(quint32,QStringList,QStringList)), core, SLOT(newCopy(quint32,QStringList,QStringList))); connect(copyServer, SIGNAL(newCopy(quint32,QStringList,QStringList,QString,QString)), core, SLOT(newCopy(quint32,QStringList,QStringList,QString,QString))); connect(copyServer, SIGNAL(newMove(quint32,QStringList,QStringList)), core, SLOT(newMove(quint32,QStringList,QStringList))); connect(copyServer, SIGNAL(newMove(quint32,QStringList,QStringList,QString,QString)), core, SLOT(newMove(quint32,QStringList,QStringList,QString,QString))); connect(core, SIGNAL(copyFinished(quint32,bool)), copyServer, SLOT(copyFinished(quint32,bool))); connect(core, SIGNAL(copyCanceled(quint32)), copyServer, SLOT(copyCanceled(quint32))); if(localListener.tryConnect()) { stopIt=true; //why before removed??? QCoreApplication::quit(); return; } localListener.listenServer(); //load the systray icon if(backgroundIcon==NULL) { backgroundIcon=new SystrayIcon(); //connect the slot //quit is for this object // connect(core, SIGNAL(newCanDoOnlyCopy(bool)), backgroundIcon, SLOT(newCanDoOnlyCopy(bool))); connect(backgroundIcon, SIGNAL(quit()),this,SLOT(quit())); //show option is for OptionEngine object connect(backgroundIcon, SIGNAL(showOptions()), &optionDialog, SLOT(show())); connect(copyServer, SIGNAL(listenerReady(ListeningState,bool,bool)), backgroundIcon, SLOT(listenerReady(ListeningState,bool,bool))); connect(copyServer, SIGNAL(pluginLoaderReady(CatchState,bool,bool)), backgroundIcon, SLOT(pluginLoaderReady(CatchState,bool,bool))); connect(backgroundIcon, SIGNAL(tryCatchCopy()), copyServer, SLOT(listen())); connect(backgroundIcon, SIGNAL(tryUncatchCopy()), copyServer, SLOT(close())); if(options->getOptionValue("CopyListener","CatchCopyAsDefault").toBool()) copyServer->listen(); ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"copyServer.oneListenerIsLoaded(): "+QString::number(copyServer->oneListenerIsLoaded())); //backgroundIcon->readyToListen(copyServer.oneListenerIsLoaded()); connect(backgroundIcon, SIGNAL(addWindowCopyMove(CopyMode,QString)), core, SLOT(addWindowCopyMove(CopyMode,QString))); connect(backgroundIcon, SIGNAL(addWindowTransfer(QString)), core, SLOT(addWindowTransfer(QString))); connect(copyEngineList, SIGNAL(addCopyEngine(QString,bool)), backgroundIcon, SLOT(addCopyEngine(QString,bool))); connect(copyEngineList, SIGNAL(removeCopyEngine(QString)), backgroundIcon, SLOT(removeCopyEngine(QString))); copyEngineList->setIsConnected(); copyServer->resendState(); } //conntect the last chance signal before quit connect(QCoreApplication::instance(),SIGNAL(aboutToQuit()),this,SLOT(quit())); //connect the slot for the help dialog connect(backgroundIcon,SIGNAL(showHelp()),&theHelp,SLOT(show())); }