]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinstatusbar.h
Forwardport 773570:
[dolphin.git] / src / dolphinstatusbar.h
index ad7c0d85fdedc857c038c7470a21f7c129eda678..1a9aaa4c172c53ccd90709d8d0f103ceeba76712 100644 (file)
  *   You should have received a copy of the GNU General Public License     *
  *   along with this program; if not, write to the                         *
  *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
 #ifndef DOLPHINSTATUSBAR_H
 #define DOLPHINSTATUSBAR_H
 
-#include <q3hbox.h>
-//Added by qt3to4:
-#include <QLabel>
-class QProgressBar;
-class QLabel;
-class QTimer;
-class StatusBarMessageLabel;
-class StatusBarSpaceInfo;
+#include <khbox.h>
+
 class DolphinView;
 class KUrl;
+class StatusBarMessageLabel;
+class StatusBarSpaceInfo;
+class QProgressBar;
+class QLabel;
 
 /**
  * @brief Represents the statusbar of a Dolphin view.
  *
  * The statusbar allows to show messages and progress
  * information.
- *
- * @author Peter Penz
  */
-class DolphinStatusBar : public Q3HBox {
+class DolphinStatusBar : public KHBox
+{
     Q_OBJECT
 
 public:
@@ -56,7 +53,9 @@ public:
         Error
     };
 
-    DolphinStatusBar(DolphinView* parent = 0);
+    DolphinStatusBar(QWidget* parent,
+                     const KUrl& url);
+
     virtual ~DolphinStatusBar();
 
     /**
@@ -71,8 +70,8 @@ public:
      * is cleared automatically.
      */
     void setMessage(const QString& msg, Type type);
-
     QString message() const;
+
     Type type() const;
 
     /**
@@ -96,7 +95,10 @@ public:
      * operations.
      */
     void setProgress(int percent);
-    int progress() const { return m_progress; }
+    int progress() const
+    {
+        return m_progress;
+    }
 
     /**
      * Clears the message text of the status bar by replacing
@@ -111,25 +113,36 @@ public:
      * is cleared by DolphinStatusBar::clear().
      */
     void setDefaultText(const QString& text);
-    const QString& defaultText() const { return m_defaultText; }
+    const QString& defaultText() const;
+
+protected:
+    /** @see QWidget::resizeEvent() */
+    virtual void resizeEvent(QResizeEvent* event);
 
 private slots:
-    void slotProgressTimer();
+    void updateProgressInfo();
 
     /**
-     * Is invoked, when the Url of the DolphinView, where the
-     * statusbar belongs too, has been changed.
+     * Is invoked, when the URL of the DolphinView, where the
+     * statusbar belongs too, has been changed. The space information
+     * content is updated.
      */
-    void slotUrlChanged(const KUrl& url);
+    void updateSpaceInfoContent(const KUrl& url);
+
+    /**
+     * Shows the space information if there is enough room to show it
+     * without the need to clip the status bar text. If the progress
+     * bar is shown, the space information won't be shown.
+     */
+    void showSpaceInfo();
 
 private:
     StatusBarMessageLabel* m_messageLabel;
     StatusBarSpaceInfo* m_spaceInfo;
+
     QLabel* m_progressText;
     QProgressBar* m_progressBar;
-    QTimer* m_progressTimer;
     int m_progress;
-    QString m_defaultText;
 };
 
 #endif