[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/apps
From:       David Faure <faure () kde ! org>
Date:       2010-08-30 8:56:20
Message-ID: 20100830085620.8D700AC857 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1169901 by dfaure:

Move dolphin's statusbar message-label (the one with support for errors and a close \
button) to libkonq so that it can be used in konqueror as well. Fix its sizeHint. \
Reviewed by Peter Penz.


 M  +0 -2      dolphin/src/CMakeLists.txt  
 M  +6 -3      dolphin/src/dolphinpart.cpp  
 M  +7 -9      dolphin/src/statusbar/dolphinstatusbar.cpp  
 M  +6 -6      dolphin/src/statusbar/dolphinstatusbar.h  
 D             dolphin/src/statusbar/statusbarmessagelabel.cpp  
 D             dolphin/src/statusbar/statusbarmessagelabel.h  
 M  +2 -1      dolphin/src/views/dolphindirlister.h  
 M  +11 -16    konqueror/src/konqframestatusbar.cpp  
 M  +5 -8      konqueror/src/konqframestatusbar.h  
 M  +3 -2      lib/konq/CMakeLists.txt  
 A             lib/konq/konq_statusbarmessagelabel.cpp   \
dolphin/src/statusbar/statusbarmessagelabel.cpp#1167259 [License: GPL (v2+)]  A       \
lib/konq/konq_statusbarmessagelabel.h   \
dolphin/src/statusbar/statusbarmessagelabel.h#1167259 [License: GPL (v2+)]


--- trunk/KDE/kdebase/apps/dolphin/src/CMakeLists.txt #1169900:1169901
@@ -133,8 +133,6 @@
     settings/viewmodes/viewsettingspagebase.cpp
     statusbar/dolphinstatusbar.cpp
     statusbar/statusbarspaceinfo.cpp
-    statusbar/statusbarmessagelabel.cpp
-    views/dolphindirlister.cpp
     views/zoomlevelinfo.cpp
 )
 
--- trunk/KDE/kdebase/apps/dolphin/src/dolphinpart.cpp #1169900:1169901
@@ -26,7 +26,6 @@
 #include <kactioncollection.h>
 #include <kconfiggroup.h>
 #include <kdebug.h>
-#include <kdirlister.h>
 #include <kglobalsettings.h>
 #include <kiconloader.h>
 #include <klocale.h>
@@ -47,6 +46,7 @@
 #include "views/dolphinmodel.h"
 #include "views/dolphinnewfilemenuobserver.h"
 #include "views/dolphinremoteencoding.h"
+#include "views/dolphindirlister.h"
 
 #include <QActionGroup>
 #include <QApplication>
@@ -65,7 +65,7 @@
     // make sure that other apps using this part find Dolphin's view-file-columns \
icons  KIconLoader::global()->addAppDir("dolphin");
 
-    m_dirLister = new KDirLister;
+    m_dirLister = new DolphinDirLister;
     m_dirLister->setAutoUpdate(true);
     if (parentWidget) {
         m_dirLister->setMainWindow(parentWidget->window());
@@ -75,6 +75,7 @@
     connect(m_dirLister, SIGNAL(completed(KUrl)), this, SLOT(slotCompleted(KUrl)));
     connect(m_dirLister, SIGNAL(canceled(KUrl)), this, SLOT(slotCanceled(KUrl)));
     connect(m_dirLister, SIGNAL(percent(int)), this, SLOT(updateProgress(int)));
+    connect(m_dirLister, SIGNAL(errorMessage(QString)), this, \
SLOT(slotErrorMessage(QString)));  
     m_dolphinModel = new DolphinModel(this);
     m_dolphinModel->setDirLister(m_dirLister);
@@ -331,7 +332,9 @@
 
 void DolphinPart::slotErrorMessage(const QString& msg)
 {
-    KMessageBox::error(m_view, msg);
+    kDebug() << msg;
+    emit canceled(msg);
+    //KMessageBox::error(m_view, msg);
 }
 
 void DolphinPart::slotRequestItemInfo(const KFileItem& item)
--- trunk/KDE/kdebase/apps/dolphin/src/statusbar/dolphinstatusbar.cpp \
#1169900:1169901 @@ -29,7 +29,6 @@
 #include <kvbox.h>
 
 #include "settings/dolphinsettings.h"
-#include "statusbarmessagelabel.h"
 #include "statusbarspaceinfo.h"
 
 #include <QApplication>
@@ -60,7 +59,7 @@
             this, SLOT(updateSpaceInfoContent(const KUrl&)));
 
     // Initialize message label
-    m_messageLabel = new StatusBarMessageLabel(this);
+    m_messageLabel = new KonqStatusBarMessageLabel(this);
 
     // Initialize zoom slider
     m_zoomWidget = new QWidget(this);
@@ -112,9 +111,7 @@
     const int zoomWidgetHeight = m_zoomWidget->minimumSizeHint().height();
     const int contentHeight = qMax(fontHeight, zoomWidgetHeight);
 
-    m_messageLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
     m_messageLabel->setMinimumTextHeight(contentHeight);
-    m_messageLabel->setMinimumWidth(100);
 
     m_spaceInfo->setMaximumSize(200, contentHeight - 5);
     m_spaceInfo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
@@ -157,7 +154,8 @@
         timeout = 0;
     }
 
-    if ((message == m_messageLabel->text()) && (type == m_messageLabel->type())) {
+    KonqStatusBarMessageLabel::Type konqType = \
static_cast<KonqStatusBarMessageLabel::Type>(type); +    if ((message == \
m_messageLabel->text()) && (konqType == m_messageLabel->type())) {  // the message is \
already shown  return;
     }
@@ -173,7 +171,7 @@
         return;
     }
 
-    m_messageLabel->setMessage(message, type);
+    m_messageLabel->setMessage(message, konqType);
     if (type != Default) {
         m_messageTimeStamp = currentTime;
     }
@@ -181,7 +179,7 @@
 
 DolphinStatusBar::Type DolphinStatusBar::type() const
 {
-    return m_messageLabel->type();
+    return static_cast<Type>(m_messageLabel->type());
 }
 
 QString DolphinStatusBar::message() const
@@ -216,7 +214,7 @@
     }
 
     m_progress = percent;
-    if (m_messageLabel->type() == Error) {
+    if (m_messageLabel->type() == KonqStatusBarMessageLabel::Error) {
         // Don't update any widget or status bar text if an
         // error message is shown
         return;
@@ -338,7 +336,7 @@
 
 void DolphinStatusBar::updateProgressInfo()
 {
-    const bool isErrorShown = (m_messageLabel->type() == Error);
+    const bool isErrorShown = (m_messageLabel->type() == \
KonqStatusBarMessageLabel::Error);  if (m_progress < 100) {
         // Show the progress information and hide the extensions
         setExtensionsVisible(false);
--- trunk/KDE/kdebase/apps/dolphin/src/statusbar/dolphinstatusbar.h #1169900:1169901
@@ -21,12 +21,12 @@
 #ifndef DOLPHINSTATUSBAR_H
 #define DOLPHINSTATUSBAR_H
 
+#include "konq_statusbarmessagelabel.h"
 #include <QTime>
 #include <QWidget>
 
 class DolphinView;
 class KUrl;
-class StatusBarMessageLabel;
 class StatusBarSpaceInfo;
 class QLabel;
 class QProgressBar;
@@ -50,10 +50,10 @@
      * used for the message text.
      */
     enum Type {
-        Default,
-        OperationCompleted,
-        Information,
-        Error
+        Default = KonqStatusBarMessageLabel::Default,
+        OperationCompleted = KonqStatusBarMessageLabel::OperationCompleted,
+        Information = KonqStatusBarMessageLabel::Information,
+        Error = KonqStatusBarMessageLabel::Error
     };
 
     explicit DolphinStatusBar(QWidget* parent, DolphinView* view);
@@ -155,7 +155,7 @@
 
 private:
     DolphinView* m_view;
-    StatusBarMessageLabel* m_messageLabel;
+    KonqStatusBarMessageLabel* m_messageLabel;
     StatusBarSpaceInfo* m_spaceInfo;
 
     QWidget* m_zoomWidget;
--- trunk/KDE/kdebase/apps/dolphin/src/views/dolphindirlister.h #1169900:1169901
@@ -20,13 +20,14 @@
 #ifndef DOLPHINDIRLISTER_H
 #define DOLPHINDIRLISTER_H
 
+#include <libdolphin_export.h>
 #include <kdirlister.h>
 
 /**
  * @brief Extends the class KDirLister by emitting a signal when an
  *        error occurred instead of showing an error dialog.
  */
-class DolphinDirLister : public KDirLister
+class LIBDOLPHINPRIVATE_EXPORT DolphinDirLister : public KDirLister
 {
     Q_OBJECT
 
--- trunk/KDE/kdebase/apps/konqueror/src/konqframestatusbar.cpp #1169900:1169901
@@ -88,15 +88,17 @@
 {
     setSizeGripEnabled( false );
 
+    // TODO remove active view indicator and use a different bg color like dolphin \
does? +    // Works nicely for file management, but not so much with other parts...
     m_led = new QLabel( this );
     m_led->setAlignment( Qt::AlignCenter );
     m_led->setSizePolicy(QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ));
     addWidget( m_led, 0 ); // led (active view indicator)
     m_led->hide();
 
-    m_pStatusLabel = new KSqueezedTextLabel( this );
-    m_pStatusLabel->setMinimumSize( 0, 0 );
-    m_pStatusLabel->setSizePolicy(QSizePolicy( QSizePolicy::Ignored, \
QSizePolicy::Fixed )); +    // TODO re-enable squeezing
+    //m_pStatusLabel = new KSqueezedTextLabel( this );
+    m_pStatusLabel = new KonqStatusBarMessageLabel( this );
     m_pStatusLabel->installEventFilter(this);
     addWidget( m_pStatusLabel, 1 /*stretch*/ ); // status label
 
@@ -122,7 +124,6 @@
     m_progressBar->hide();
     addPermanentWidget( m_progressBar, 0 );
 
-    fontChange(QFont());
     installEventFilter( this );
 }
 
@@ -130,17 +131,6 @@
 {
 }
 
-void KonqFrameStatusBar::fontChange(const QFont & /* oldFont */)
-{
-    int h = fontMetrics().height();
-    if ( h < DEFAULT_HEADER_HEIGHT ) h = DEFAULT_HEADER_HEIGHT;
-    m_led->setFixedHeight( h + 2 );
-    m_progressBar->setFixedHeight( h + 2 );
-    // This one is important. Otherwise richtext messages make it grow in height.
-    m_pStatusLabel->setFixedHeight( h + 2 );
-
-}
-
 // I don't think this code _ever_ gets called!
 // I don't want to remove it, though.  :-)
 void KonqFrameStatusBar::mousePressEvent( QMouseEvent* event )
@@ -217,7 +207,7 @@
 void KonqFrameStatusBar::slotDisplayStatusText(const QString& text)
 {
     //kDebug() << text;
-    m_pStatusLabel->setText(text);
+    m_pStatusLabel->setMessage(text, KonqStatusBarMessageLabel::Default);
     m_savedMessage = text;
 }
 
@@ -297,4 +287,9 @@
     m_led->setPixmap( hasFocus ? indicator_viewactive : indicator_empty );
 }
 
+void KonqFrameStatusBar::setMessage(const QString& msg, \
KonqStatusBarMessageLabel::Type type) +{
+    m_pStatusLabel->setMessage(msg, type);
+}
+
 #include "konqframestatusbar.moc"
--- trunk/KDE/kdebase/apps/konqueror/src/konqframestatusbar.h #1169900:1169901
@@ -1,6 +1,6 @@
 /*  This file is part of the KDE project
     Copyright (C) 1998, 1999 Michael Reiher <michael.reiher@gmx.de>
-    Copyright 2007 David Faure <faure@kde.org>
+    Copyright 2007, 2010 David Faure <faure@kde.org>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -21,11 +21,11 @@
 #define KONQ_FRAMESTATUSBAR_H
 
 #include <KStatusBar>
+#include "konq_statusbarmessagelabel.h"
 class QLabel;
 class QProgressBar;
 class QCheckBox;
 class KonqView;
-class KSqueezedTextLabel;
 class KonqFrame;
 namespace KParts { class ReadOnlyPart; }
 
@@ -42,6 +42,8 @@
     explicit KonqFrameStatusBar( KonqFrame *_parent = 0 );
     virtual ~KonqFrameStatusBar();
 
+    void setMessage(const QString& msg, KonqStatusBarMessageLabel::Type type);
+
     /**
      * Checks/unchecks the linked-view checkbox
      */
@@ -87,16 +89,11 @@
      */
     virtual void splitFrameMenu();
 
-    /**
-     * Takes care of the statusbars size
-     **/
-    virtual void fontChange(const QFont &oldFont);
-
 private:
     KonqFrame* m_pParentKonqFrame;
     QCheckBox *m_pLinkedViewCheckBox;
     QProgressBar *m_progressBar;
-    KSqueezedTextLabel *m_pStatusLabel;
+    KonqStatusBarMessageLabel *m_pStatusLabel;
     QLabel* m_led;
     QString m_savedMessage;
 };
--- trunk/KDE/kdebase/apps/lib/konq/CMakeLists.txt #1169900:1169901
@@ -14,14 +14,15 @@
    konq_dndpopupmenuplugin.cpp # for KonqDndPopupMenu and its plugins
    konq_copytomenu.cpp      # used by dolphin, KonqPopupMenu
    konq_operations.cpp      # used by dolphin and konqueror
+   konq_statusbarmessagelabel.cpp  # used by dolphin and konqueror
    konq_events.cpp
    konqmimedata.cpp         # used by dolphin, KonqOperations, some filemanagement \
konqueror modules.  konq_historyentry.cpp
    konq_historyloader.cpp
    konq_historyprovider.cpp
    kversioncontrolplugin.cpp # used by dolphin and its version control plugins
-   konq_nameandurlinputdialog.cpp # used by KNewMenu internally, and by the sidebar \
externally  
+   konq_nameandurlinputdialog.cpp # deprecated (functionality has moved to kdelibs)
    knewmenu.cpp # deprecated (functionality has moved to kdelibs)
    konq_popupmenuinformation.cpp # deprecated (functionality has moved to kdelibs)
    konq_menuactions.cpp     # deprecated (functionality has moved to kdelibs)
@@ -30,7 +31,7 @@
 
 kde4_add_library(konq SHARED ${konq_LIB_SRCS})
 
-target_link_libraries(konq ${KDE4_KPARTS_LIBS} ${KDE4_KFILE_LIBS} ${ZLIB_LIBRARY})
+target_link_libraries(konq ${KDE4_KPARTS_LIBS} ${KDE4_KFILE_LIBS} ${ZLIB_LIBRARY} \
${X11_X11_LIB})  target_link_libraries(konq LINK_INTERFACE_LIBRARIES \
${KDE4_KPARTS_LIBS})  
 set_target_properties(konq PROPERTIES


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic