File indexing completed on 2024-05-26 05:28:14
0001 /* Copyright (C) 2012 Thomas Gahr <thomas.gahr@physik.uni-muenchen.de> 0002 Copyright (C) 2006 - 2016 Jan Kundrát <jkt@kde.org> 0003 0004 This file is part of the Trojita Qt IMAP e-mail client, 0005 http://trojita.flaska.net/ 0006 0007 This program is free software; you can redistribute it and/or 0008 modify it under the terms of the GNU General Public License as 0009 published by the Free Software Foundation; either version 2 of 0010 the License or (at your option) version 3 or any later version 0011 accepted by the membership of KDE e.V. (or its successor approved 0012 by the membership of KDE e.V.), which shall act as a proxy 0013 defined in Section 14 of version 3 of the license. 0014 0015 This program is distributed in the hope that it will be useful, 0016 but WITHOUT ANY WARRANTY; without even the implied warranty of 0017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0018 GNU General Public License for more details. 0019 0020 You should have received a copy of the GNU General Public License 0021 along with this program. If not, see <http://www.gnu.org/licenses/>. 0022 */ 0023 0024 #ifndef GUI_MAILBOXTREEVIEW_H 0025 #define GUI_MAILBOXTREEVIEW_H 0026 0027 #include <QSettings> 0028 #include <QTreeView> 0029 0030 namespace Imap { 0031 namespace Mailbox { 0032 class MailboxFinder; 0033 } 0034 } 0035 0036 namespace Gui { 0037 0038 /** @short Show mailboxes in a tree view */ 0039 class MailBoxTreeView : public QTreeView 0040 { 0041 Q_OBJECT 0042 public: 0043 explicit MailBoxTreeView(QWidget *parent, QSettings *settings); 0044 void setDesiredExpansion(const QStringList &mailboxNames); 0045 void setModel(QAbstractItemModel *model) override; 0046 signals: 0047 /** @short User has changed their mind about the expanded/collapsed state of the mailbox tree 0048 0049 Stuff which gets reported here might refer to mailboxes which do not even exist. At the same time, 0050 the code will not forget about those mailboxes which "aren't there yet". 0051 */ 0052 void mailboxExpansionChanged(const QStringList &mailboxNames); 0053 protected: 0054 void dragMoveEvent(QDragMoveEvent *event) override; 0055 void dropEvent(QDropEvent *event) override; 0056 void dragEnterEvent(QDragEnterEvent *event) override; 0057 void resetWatchedMailboxes(); 0058 Qt::DropAction defaultDropAction(); 0059 private: 0060 Imap::Mailbox::MailboxFinder *m_mailboxFinder; 0061 QSet<QString> m_desiredExpansionState; 0062 QSettings *m_settings; 0063 }; 0064 } 0065 0066 #endif // GUI_MAILBOXTREEVIEW_H