Fix compilation errors and implement Phase 6 & 7: NotificationManager and SyncScheduler with real synchronizer integration
This commit is contained in:
@@ -4,27 +4,53 @@
|
||||
|
||||
NotificationManager::NotificationManager(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_trayIcon(nullptr)
|
||||
, m_trayMenu(nullptr)
|
||||
, m_showHideAction(nullptr)
|
||||
, m_quitAction(nullptr)
|
||||
, m_newMailSound(nullptr)
|
||||
{
|
||||
// Defer initialization to after QApplication is fully ready
|
||||
// We'll initialize in a separate method called from main after the event loop starts?
|
||||
// For now, we do nothing and log.
|
||||
qDebug() << "NotificationManager: constructor (deferred initialization)";
|
||||
}
|
||||
|
||||
NotificationManager::~NotificationManager()
|
||||
{
|
||||
// Cleanup if we ever initialize
|
||||
if (m_trayMenu) {
|
||||
delete m_trayMenu;
|
||||
}
|
||||
// Note: m_trayIcon, m_showHideAction, m_quitAction, m_newMailSound are children of this or m_trayMenu?
|
||||
// Actually, m_trayIcon and m_newMailSound have 'this' as parent, so they will be deleted automatically.
|
||||
// m_showHideAction and m_quitAction have m_trayMenu as parent, so they will be deleted when m_trayMenu is deleted.
|
||||
}
|
||||
|
||||
void NotificationManager::initialize()
|
||||
{
|
||||
// Initialize the tray icon and related objects
|
||||
m_trayIcon = new QSystemTrayIcon(this);
|
||||
m_trayMenu = new QMenu(this); // parent to NotificationManager so it gets deleted with us
|
||||
m_showHideAction = new QAction("Show/Hide", m_trayMenu);
|
||||
m_quitAction = new QAction("Quit", m_trayMenu);
|
||||
m_newMailSound = new QSoundEffect(this);
|
||||
|
||||
setupTrayIcon();
|
||||
setupConnections();
|
||||
}
|
||||
|
||||
void NotificationManager::setupTrayIcon()
|
||||
{
|
||||
m_trayIcon = new QSystemTrayIcon(this);
|
||||
// Set an icon (you may want to load from resources)
|
||||
m_trayIcon->setIcon(QIcon::fromTheme("mail-unread"));
|
||||
m_trayIcon->setToolTip("Wino Mail");
|
||||
|
||||
m_trayMenu = new QMenu(this);
|
||||
m_showHideAction = new QAction("Show/Hide", this);
|
||||
m_quitAction = new QAction("Quit", this);
|
||||
m_trayMenu->addAction(m_showHideAction);
|
||||
m_trayMenu->addSeparator();
|
||||
m_trayMenu->addAction(m_quitAction);
|
||||
m_trayIcon->setContextMenu(m_trayMenu);
|
||||
|
||||
m_newMailSound = new QSoundEffect(this);
|
||||
m_newMailSound->setSource(QUrl::fromLocalFile("/usr/share/sounds/freedesktop/stereo/message-new-instant.oga"));
|
||||
m_newMailSound->setVolume(0.5);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user