]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kstandarditemlistwidget.h
Fix bug 303375 - Dots in directory names treated as file extension.
[dolphin.git] / src / kitemviews / kstandarditemlistwidget.h
index 72c081b311c7a2fc515863ba7c1c3969f091024a..82b68eac9a38ad667f849ab1370bea8c9ca0df18 100644 (file)
@@ -115,6 +115,11 @@ protected:
      */
     virtual bool isHidden() const;
 
+    /**
+     * @return A font based on baseFont which is customized according to the data shown in the widget.
+     */
+    virtual QFont customizedFont(const QFont& baseFont) const;
+
     void setTextColor(const QColor& color);
     QColor textColor() const;
 
@@ -126,6 +131,19 @@ protected:
      */
     QString roleText(const QByteArray& role, const QHash<QByteArray, QVariant>& values) const;
 
+    /**
+     * Fixes:
+     * Select the text without MIME-type extension
+     * This is file-item-specific and should be moved
+     * into KFileItemListWidget.
+     *
+     * Inherited classes can define, if the MIME-type extension
+     * should be selected or not.
+     *
+     * @return Selection length (with or without MIME-type extension)
+     */
+    virtual int selectionLength(const QString& text) const;
+
     virtual void dataChanged(const QHash<QByteArray, QVariant>& current, const QSet<QByteArray>& roles = QSet<QByteArray>());
     virtual void visibleRolesChanged(const QList<QByteArray>& current, const QList<QByteArray>& previous);
     virtual void columnWidthChanged(const QByteArray& role, qreal current, qreal previous);
@@ -160,6 +178,12 @@ private:
 
     QRectF roleEditingRect(const QByteArray &role) const;
 
+    /**
+     * Closes the role editor and returns the focus back
+     * to the KItemListContainer.
+     */
+    void closeRoleEditor();
+
     static QPixmap pixmapForIcon(const QString& name, int size);
 
     /**
@@ -178,6 +202,8 @@ private:
 private:
     bool m_isCut;
     bool m_isHidden;
+    QFont m_customizedFont;
+    QFontMetrics m_customizedFontMetrics;
     bool m_isExpandable;
     bool m_supportsItemExpanding;