[kde-doc-english] [kdelibs] kio/kfile: GUI: Make "Edit File Type" button an actual button and make it more obvious.

Kai Uwe Broulik kde at privat.broulik.de
Fri Jul 22 17:05:10 CEST 2011


Git commit 131fabf76ec4688561892ba87e2aa86ad828ca70 by Kai Uwe Broulik.
Committed on 22/07/2011 at 17:04.
Pushed by broulik into branch 'master'.

GUI: Make "Edit File Type" button an actual button and make it more obvious.

REVIEW: 101800

M  +8    -11   kio/kfile/kpropertiesdialog.cpp

http://commits.kde.org/kdelibs/131fabf76ec4688561892ba87e2aa86ad828ca70

diff --git a/kio/kfile/kpropertiesdialog.cpp b/kio/kfile/kpropertiesdialog.cpp
index 3382daa..ba56f18 100644
--- a/kio/kfile/kpropertiesdialog.cpp
+++ b/kio/kfile/kpropertiesdialog.cpp
@@ -945,29 +945,26 @@ KFilePropsPlugin::KFilePropsPlugin( KPropertiesDialog *_props )
     QLabel *l;
     if (!mimeComment.isEmpty() && !isTrash) {
         l = new QLabel(i18n("Type:"), d->m_frame );
+        grid->addWidget(l, curRow, 0, Qt::AlignRight | Qt::AlignTop);
 
-        grid->addWidget(l, curRow, 0, Qt::AlignRight);
-
-        KHBox *box = new KHBox(d->m_frame);
-        box->setSpacing(20); // ### why 20?
+        KVBox *box = new KVBox(d->m_frame);
+        box->setSpacing(2); // without that spacing the button literally “sticks” to the label ;)
         l = new QLabel(mimeComment, box );
+        grid->addWidget(box, curRow++, 2);
 
         QPushButton *button = new QPushButton(box);
-
+        button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);  // Minimum still makes the button grow to the entire layout width
         button->setIcon( KIcon(QString::fromLatin1("configure")) );
-        const int pixmapSize = button->style()->pixelMetric(QStyle::PM_SmallIconSize);
-        button->setFixedSize( pixmapSize+8, pixmapSize+8 );
+
         if ( d->mimeType == KMimeType::defaultMimeType() )
-            button->setToolTip(i18n("Create new file type"));
+            button->setText(i18n("Create New File Type"));
         else
-            button->setToolTip(i18n("Edit file type"));
+            button->setText(i18n("File Type Options"));
 
         connect( button, SIGNAL( clicked() ), SLOT( slotEditFileType() ));
 
         if (!KAuthorized::authorizeKAction("editfiletype"))
             button->hide();
-
-        grid->addWidget(box, curRow++, 2);
     }
 
     if ( !magicMimeComment.isEmpty() && magicMimeComment != mimeComment )


More information about the kde-doc-english mailing list