File indexing completed on 2024-12-22 05:01:13

0001 /*
0002   This file is part of KDE Kontact.
0003 
0004   SPDX-FileCopyrightText: 2003 Sven Lüppken <sven@kde.org>
0005   SPDX-FileCopyrightText: 2003 Tobias König <tokoe@kde.org>
0006   SPDX-FileCopyrightText: 2003 Daniel Molkentin <molkentin@kde.org>
0007 
0008   SPDX-License-Identifier: LGPL-2.0-or-later
0009 */
0010 
0011 #pragma once
0012 
0013 #include <KParts/Part>
0014 #include <QDate>
0015 #include <QMap>
0016 
0017 class DropWidget;
0018 
0019 namespace KontactInterface
0020 {
0021 class Core;
0022 class Summary;
0023 }
0024 
0025 class KAboutData;
0026 class QAction;
0027 
0028 class QFrame;
0029 class QLabel;
0030 class QVBoxLayout;
0031 
0032 class SummaryViewPart : public KParts::Part
0033 {
0034     Q_OBJECT
0035 
0036 public:
0037     SummaryViewPart(KontactInterface::Core *core, const KAboutData &aboutData, QObject *parent = nullptr);
0038     ~SummaryViewPart() override;
0039 
0040 public Q_SLOTS:
0041     void slotTextChanged();
0042     void slotAdjustPalette();
0043     void setDate(QDate newDate);
0044     void updateSummaries();
0045 
0046 Q_SIGNALS:
0047     void textChanged(const QString &);
0048 
0049 protected:
0050     void partActivateEvent(KParts::PartActivateEvent *event) override;
0051 
0052     bool event(QEvent *e) override;
0053 protected Q_SLOTS:
0054     void slotConfigure();
0055     void updateWidgets();
0056     void summaryWidgetMoved(QWidget *target, QObject *obj, int alignment);
0057 
0058 private:
0059     void initGUI(KontactInterface::Core *core);
0060     void loadLayout();
0061     void saveLayout();
0062     QString widgetName(QWidget *) const;
0063 
0064     void drawLtoR(QWidget *target, QWidget *widget, int alignment);
0065     void drawRtoL(QWidget *target, QWidget *widget, int alignment);
0066 
0067     QMap<QString, KontactInterface::Summary *> mSummaries;
0068     QStringList mLeftColumnSummaries;
0069     QStringList mRightColumnSummaries;
0070     KontactInterface::Core *mCore = nullptr;
0071     DropWidget *mFrame = nullptr;
0072     QFrame *mMainWidget = nullptr;
0073     QVBoxLayout *mMainLayout = nullptr;
0074     QVBoxLayout *mLeftColumn = nullptr;
0075     QVBoxLayout *mRightColumn = nullptr;
0076     QLabel *mUsernameLabel = nullptr;
0077     QLabel *mDateLabel = nullptr;
0078     QAction *mConfigAction = nullptr;
0079 };