diff --git a/src/filewidgets/CMakeLists.txt b/src/filewidgets/CMakeLists.txt --- a/src/filewidgets/CMakeLists.txt +++ b/src/filewidgets/CMakeLists.txt @@ -22,6 +22,7 @@ kfilecustomdialog.cpp kfilefiltercombo.cpp kfilewidget.cpp + kfilewidgetdocktitlebar.cpp kfileplacesitem.cpp kfileplacesmodel.cpp kfileplacesview.cpp diff --git a/src/filewidgets/kfilewidget.cpp b/src/filewidgets/kfilewidget.cpp --- a/src/filewidgets/kfilewidget.cpp +++ b/src/filewidgets/kfilewidget.cpp @@ -33,6 +33,7 @@ #include "kurlcombobox.h" #include "kurlnavigator.h" #include "kfilepreviewgenerator.h" +#include "kfilewidgetdocktitlebar_p.h" #include #include @@ -1355,7 +1356,8 @@ } placesDock = new QDockWidget(i18nc("@title:window", "Places"), q); - placesDock->setFeatures(QDockWidget::DockWidgetClosable); + placesDock->setFeatures(QDockWidget::NoDockWidgetFeatures); + placesDock->setTitleBarWidget(new KDEPrivate::KFileWidgetDockTitleBar(placesDock)); placesView = new KFilePlacesView(placesDock); placesView->setModel(model); diff --git a/src/filewidgets/kfilewidgetdocktitlebar.cpp b/src/filewidgets/kfilewidgetdocktitlebar.cpp new file mode 100644 --- /dev/null +++ b/src/filewidgets/kfilewidgetdocktitlebar.cpp @@ -0,0 +1,45 @@ +/***************************************************************************** + * Copyright (C) 2018 Kai Uwe Broulik * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public License * + * along with this library; see the file COPYING.LIB. If not, write to * + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301, USA. * + *****************************************************************************/ + +#include "kfilewidgetdocktitlebar_p.h" + +#include + +using namespace KDEPrivate; + +KFileWidgetDockTitleBar::KFileWidgetDockTitleBar(QWidget *parent) : QWidget(parent) +{ +} + +KFileWidgetDockTitleBar::~KFileWidgetDockTitleBar() +{ +} + +QSize KFileWidgetDockTitleBar::minimumSizeHint() const +{ + const int border = style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin); + return QSize(border, border); +} + +QSize KFileWidgetDockTitleBar::sizeHint() const +{ + return minimumSizeHint(); +} + +#include "moc_kfilewidgetdocktitlebar_p.cpp" diff --git a/src/filewidgets/kfilewidgetdocktitlebar_p.h b/src/filewidgets/kfilewidgetdocktitlebar_p.h new file mode 100644 --- /dev/null +++ b/src/filewidgets/kfilewidgetdocktitlebar_p.h @@ -0,0 +1,45 @@ +/***************************************************************************** + * Copyright (C) 2018 Kai Uwe Broulik * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public License * + * along with this library; see the file COPYING.LIB. If not, write to * + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301, USA. * + *****************************************************************************/ + +#ifndef KFILEWIDGETDOCKTITLEBAR_P_H +#define KFILEWIDGETDOCKTITLEBAR_P_H + +#include + +namespace KDEPrivate +{ + +/** + * @brief An empty title bar for the Places dock widget + */ +class KFileWidgetDockTitleBar : public QWidget +{ + Q_OBJECT + +public: + explicit KFileWidgetDockTitleBar(QWidget *parent); + ~KFileWidgetDockTitleBar() Q_DECL_OVERRIDE; + + QSize minimumSizeHint() const Q_DECL_OVERRIDE; + QSize sizeHint() const Q_DECL_OVERRIDE; +}; + +} // namespace KDEPrivate + +#endif // KFILEWIDGETDOCKTITLEBAR_P_H