File indexing completed on 2024-04-21 04:58:15

0001 /*  This file is part of the KDE project
0002     SPDX-FileCopyrightText: 1998, 1999 Michael Reiher <michael.reiher@gmx.de>
0003     SPDX-FileCopyrightText: 2007, 2010 David Faure <faure@kde.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef KONQ_FRAMESTATUSBAR_H
0009 #define KONQ_FRAMESTATUSBAR_H
0010 
0011 #include <QStatusBar>
0012 #include "konqstatusbarmessagelabel.h"
0013 class QLabel;
0014 class QProgressBar;
0015 class QCheckBox;
0016 class KonqView;
0017 class KonqFrame;
0018 namespace KParts
0019 {
0020 class ReadOnlyPart;
0021 }
0022 
0023 /**
0024  * The KonqFrameStatusBar is the statusbar under each konqueror view.
0025  * It indicates in particular whether a view is active or not.
0026  */
0027 class KonqFrameStatusBar : public QStatusBar
0028 {
0029     Q_OBJECT
0030 
0031 public:
0032     explicit KonqFrameStatusBar(KonqFrame *_parent = nullptr);
0033     ~KonqFrameStatusBar() override;
0034 
0035     void setMessage(const QString &msg, KonqStatusBarMessageLabel::Type type);
0036 
0037     /**
0038      * Checks/unchecks the linked-view checkbox
0039      */
0040     void setLinkedView(bool b);
0041     /**
0042      * Shows/hides the active-view indicator
0043      */
0044     void showActiveViewIndicator(bool b);
0045     /**
0046      * Shows/hides the linked-view indicator
0047      */
0048     void showLinkedViewIndicator(bool b);
0049     /**
0050      * Updates the active-view indicator and the statusbar color.
0051      */
0052     void updateActiveStatus();
0053 
0054 public Q_SLOTS:
0055     void slotConnectToNewView(KonqView *, KParts::ReadOnlyPart *oldOne, KParts::ReadOnlyPart *newOne);
0056     void slotLoadingProgress(int percent);
0057     void slotSpeedProgress(int bytesPerSecond);
0058     void slotDisplayStatusText(const QString &text);
0059 
0060     void slotClear();
0061     void message(const QString &message);
0062 
0063 Q_SIGNALS:
0064     /**
0065      * This signal is emitted when the user clicked the bar.
0066      */
0067     void clicked();
0068 
0069     /**
0070      * The "linked view" checkbox was clicked
0071      */
0072     void linkedViewClicked(bool mode);
0073 
0074 protected:
0075     bool eventFilter(QObject *, QEvent *) override;
0076     void mousePressEvent(QMouseEvent *) override;
0077     /**
0078      * Brings up the context menu for this frame
0079      */
0080     virtual void splitFrameMenu();
0081 
0082 private:
0083     KonqFrame *m_pParentKonqFrame;
0084     QCheckBox *m_pLinkedViewCheckBox;
0085     QProgressBar *m_progressBar;
0086     KonqStatusBarMessageLabel *m_pStatusLabel;
0087     QLabel *m_led;
0088     QString m_savedMessage;
0089 };
0090 
0091 #endif /* KONQ_FRAMESTATUSBAR_H */
0092