2026-06-17 22:44:27 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
|
#include <QStackedWidget>
|
|
|
|
|
#include <QListWidget>
|
|
|
|
|
#include <QSplitter>
|
|
|
|
|
#include <QTreeView>
|
|
|
|
|
#include <QStatusBar>
|
2026-07-05 10:45:44 +02:00
|
|
|
#include <QProgressBar>
|
2026-06-17 22:44:27 +02:00
|
|
|
#include <QToolBar>
|
|
|
|
|
#include <QAction>
|
|
|
|
|
|
|
|
|
|
#include "ui/readerview.h"
|
|
|
|
|
#include "ui/maillistview.h"
|
|
|
|
|
#include "ui/composeview.h"
|
|
|
|
|
#include "ui/settingsview.h"
|
|
|
|
|
#include "ui/contactsview.h"
|
|
|
|
|
#include "ui/calendarview.h"
|
|
|
|
|
#include "ui/models/FolderListModel.h"
|
|
|
|
|
#include "ui/models/EmailListModel.h"
|
|
|
|
|
#include "services/accountservice.h"
|
|
|
|
|
#include "services/mailservice.h"
|
|
|
|
|
|
|
|
|
|
class MainMainWindow : public QMainWindow {
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit MainMainWindow(QWidget *parent = nullptr);
|
|
|
|
|
~MainMainWindow() override = default;
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void onNavChanged(int index);
|
|
|
|
|
void onFolderSelected(const QModelIndex &index);
|
|
|
|
|
void onEmailSelected(int mailId);
|
|
|
|
|
void onComposeRequested();
|
|
|
|
|
void onReaderReplyRequested(const MailItem *item);
|
|
|
|
|
void onNewMessage();
|
2026-06-18 18:58:27 +02:00
|
|
|
void openMailInIndependentWindow(int mailId);
|
2026-07-05 10:45:44 +02:00
|
|
|
void onAddAccountRequested();
|
|
|
|
|
void onAccountEditRequested(int accountId);
|
|
|
|
|
void onAccountDeleteRequested(int accountId);
|
|
|
|
|
void onProgressChanged(int percent);
|
|
|
|
|
void onStatusMessage(const QString &msg);
|
2026-06-17 22:44:27 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void setupUI();
|
|
|
|
|
void setupSidebar();
|
|
|
|
|
void setupMailPage();
|
|
|
|
|
void connectModels();
|
|
|
|
|
void createToolBar();
|
|
|
|
|
void switchToPage(int pageIndex);
|
|
|
|
|
|
|
|
|
|
// Navigation
|
|
|
|
|
QListWidget *m_sidebar;
|
|
|
|
|
QStackedWidget *m_stack;
|
|
|
|
|
|
|
|
|
|
enum Page {
|
|
|
|
|
PageMail = 0,
|
|
|
|
|
PageCompose,
|
|
|
|
|
PageSettings,
|
|
|
|
|
PageContacts,
|
|
|
|
|
PageCalendar
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Mail page widgets
|
|
|
|
|
QWidget *m_mailPage;
|
|
|
|
|
QSplitter *m_folderSplitter;
|
|
|
|
|
QTreeView *m_folderTree;
|
|
|
|
|
MailListView *m_mailListView;
|
|
|
|
|
ReaderView *m_emailViewer;
|
|
|
|
|
|
|
|
|
|
// Other pages
|
|
|
|
|
ComposeView *m_composeView;
|
|
|
|
|
SettingsView *m_settingsView;
|
|
|
|
|
ContactsView *m_contactsView;
|
|
|
|
|
CalendarView *m_calendarView;
|
|
|
|
|
|
|
|
|
|
// Services & Models
|
|
|
|
|
FolderListModel *m_folderModel;
|
|
|
|
|
EmailListModel *m_emailModel;
|
|
|
|
|
AccountService *m_accountService;
|
|
|
|
|
MailService *m_mailService;
|
|
|
|
|
|
|
|
|
|
QToolBar *m_toolBar;
|
|
|
|
|
int m_currentFolderId;
|
2026-06-23 01:34:13 +02:00
|
|
|
int m_currentMailId;
|
2026-07-05 10:45:44 +02:00
|
|
|
|
|
|
|
|
QProgressBar *m_progressBar;
|
2026-06-17 22:44:27 +02:00
|
|
|
};
|