Commit ed916737 authored by Tim Beaulen's avatar Tim Beaulen

KDialogBase to KDialog

And some other updates to fix the layout of the search dialog.


svn path=/trunk/KDE/kdemultimedia/juk/; revision=538290
parent e81c4d4a
...@@ -17,14 +17,14 @@ ...@@ -17,14 +17,14 @@
#include <klineedit.h> #include <klineedit.h>
#include <kpushbutton.h> #include <kpushbutton.h>
#include <klocale.h> #include <klocale.h>
#include <kvbox.h>
#include <qradiobutton.h> #include <qradiobutton.h>
#include <qlabel.h> #include <qlabel.h>
#include <q3hbox.h>
#include <q3vbox.h>
#include <qlayout.h> #include <qlayout.h>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QVBoxLayout>
#include <QBoxLayout> #include <QBoxLayout>
#include <QGroupBox> #include <QGroupBox>
...@@ -42,28 +42,37 @@ AdvancedSearchDialog::AdvancedSearchDialog(const QString &defaultName, ...@@ -42,28 +42,37 @@ AdvancedSearchDialog::AdvancedSearchDialog(const QString &defaultName,
const PlaylistSearch &defaultSearch, const PlaylistSearch &defaultSearch,
QWidget *parent, QWidget *parent,
const char *name) : const char *name) :
KDialogBase(parent, name, true, i18n("Create Search Playlist"), Ok|Cancel) KDialog(parent, i18n("Create Search Playlist"), Ok|Cancel)
{ {
makeVBoxMainWidget(); setObjectName(name);
setModal(true);
Q3HBox *box = new Q3HBox(mainWidget()); KVBox *mw = new KVBox(this);
setMainWidget(mw);
KHBox *box = new KHBox(mw);
box->setSpacing(5); box->setSpacing(5);
new QLabel(i18n("Playlist name:"), box); new QLabel(i18n("Playlist name:"), box);
m_playlistNameLineEdit = new KLineEdit(defaultName, box); m_playlistNameLineEdit = new KLineEdit(defaultName, box);
QGroupBox *criteriaGroupBox = new QGroupBox(i18n("Search Criteria"), mainWidget()); QGroupBox *criteriaGroupBox = new QGroupBox(i18n("Search Criteria"), mw);
static_cast<Q3HBox *>(mainWidget())->setStretchFactor(criteriaGroupBox, 1); mw->setStretchFactor(criteriaGroupBox, 1);
QVBoxLayout *criteriaLayout = new QVBoxLayout;
Q3HButtonGroup *group = new Q3HButtonGroup(criteriaGroupBox); Q3HButtonGroup *group = new Q3HButtonGroup();
m_matchAnyButton = new QRadioButton(i18n("Match any of the following"), group); m_matchAnyButton = new QRadioButton(i18n("Match any of the following"), group);
m_matchAllButton = new QRadioButton(i18n("Match all of the following"), group); m_matchAllButton = new QRadioButton(i18n("Match all of the following"), group);
criteriaLayout->addWidget(group);
m_criteria = new Q3VBox(criteriaGroupBox);
if(defaultSearch.isNull()) { if(defaultSearch.isNull()) {
m_searchLines.append(new SearchLine(m_criteria)); SearchLine *newSearchLine = new SearchLine(0);
m_searchLines.append(new SearchLine(m_criteria)); m_searchLines.append(newSearchLine);
criteriaLayout->addWidget(newSearchLine);
newSearchLine = new SearchLine(0);
m_searchLines.append(newSearchLine);
criteriaLayout->addWidget(newSearchLine);
m_matchAnyButton->setChecked(true); m_matchAnyButton->setChecked(true);
} }
else { else {
...@@ -72,9 +81,10 @@ AdvancedSearchDialog::AdvancedSearchDialog(const QString &defaultName, ...@@ -72,9 +81,10 @@ AdvancedSearchDialog::AdvancedSearchDialog(const QString &defaultName,
it != components.end(); it != components.end();
++it) ++it)
{ {
SearchLine *s = new SearchLine(m_criteria); SearchLine *s = new SearchLine(0);
s->setSearchComponent(*it); s->setSearchComponent(*it);
m_searchLines.append(s); m_searchLines.append(s);
criteriaLayout->addWidget(s);
} }
if(defaultSearch.searchMode() == PlaylistSearch::MatchAny) if(defaultSearch.searchMode() == PlaylistSearch::MatchAny)
m_matchAnyButton->setChecked(true); m_matchAnyButton->setChecked(true);
...@@ -82,8 +92,8 @@ AdvancedSearchDialog::AdvancedSearchDialog(const QString &defaultName, ...@@ -82,8 +92,8 @@ AdvancedSearchDialog::AdvancedSearchDialog(const QString &defaultName,
m_matchAllButton->setChecked(true); m_matchAllButton->setChecked(true);
} }
QWidget *buttons = new QWidget(criteriaGroupBox); QWidget *buttons = new QWidget();
QBoxLayout *l = new QHBoxLayout(buttons); QHBoxLayout *l = new QHBoxLayout(buttons);
l->setSpacing(5); l->setSpacing(5);
l->setMargin(0); l->setMargin(0);
...@@ -101,6 +111,10 @@ AdvancedSearchDialog::AdvancedSearchDialog(const QString &defaultName, ...@@ -101,6 +111,10 @@ AdvancedSearchDialog::AdvancedSearchDialog(const QString &defaultName,
connect(m_fewerButton, SIGNAL(clicked()), SLOT(fewer())); connect(m_fewerButton, SIGNAL(clicked()), SLOT(fewer()));
l->addWidget(m_fewerButton); l->addWidget(m_fewerButton);
criteriaLayout->addWidget(buttons);
criteriaGroupBox->setLayout(criteriaLayout);
m_playlistNameLineEdit->setFocus(); m_playlistNameLineEdit->setFocus();
} }
...@@ -116,7 +130,7 @@ AdvancedSearchDialog::~AdvancedSearchDialog() ...@@ -116,7 +130,7 @@ AdvancedSearchDialog::~AdvancedSearchDialog()
AdvancedSearchDialog::Result AdvancedSearchDialog::exec() AdvancedSearchDialog::Result AdvancedSearchDialog::exec()
{ {
Result r; Result r;
r.result = DialogCode(KDialogBase::exec()); r.result = DialogCode(KDialog::exec());
r.search = m_search; r.search = m_search;
r.playlistName = m_playlistName; r.playlistName = m_playlistName;
return r; return r;
...@@ -142,7 +156,7 @@ void AdvancedSearchDialog::accept() ...@@ -142,7 +156,7 @@ void AdvancedSearchDialog::accept()
m_playlistName = m_playlistNameLineEdit->text(); m_playlistName = m_playlistNameLineEdit->text();
KDialogBase::accept(); KDialog::accept();
} }
void AdvancedSearchDialog::clear() void AdvancedSearchDialog::clear()
......
...@@ -16,17 +16,18 @@ ...@@ -16,17 +16,18 @@
#ifndef ADVANCEDSEARCHDIALOG_H #ifndef ADVANCEDSEARCHDIALOG_H
#define ADVANCEDSEARCHDIALOG_H #define ADVANCEDSEARCHDIALOG_H
#include <kdialogbase.h> #include <kdialog.h>
//Added by qt3to4: //Added by qt3to4:
#include <Q3ValueList> #include <Q3ValueList>
#include "searchwidget.h"
class KLineEdit; class KLineEdit;
class KPushButton; class KPushButton;
class Q3GroupBox; class Q3GroupBox;
class QRadioButton; class QRadioButton;
class SearchLine;
class AdvancedSearchDialog : public KDialogBase
class AdvancedSearchDialog : public KDialog
{ {
Q_OBJECT Q_OBJECT
......
...@@ -98,7 +98,7 @@ public: ...@@ -98,7 +98,7 @@ public:
virtual bool canReload() const { return true; } virtual bool canReload() const { return true; }
public slots: public slots:
virtual void paste() { decode(kapp->clipboard()->data()); } virtual void paste() { decode(kapp->clipboard()->mimeData()); }
virtual void clear(); virtual void clear();
void slotCheckCache(); void slotCheckCache();
......
...@@ -745,7 +745,7 @@ void Playlist::copy() ...@@ -745,7 +745,7 @@ void Playlist::copy()
void Playlist::paste() void Playlist::paste()
{ {
decode(kapp->clipboard()->data(), static_cast<PlaylistItem *>(currentItem())); decode(kapp->clipboard()->mimeData(), static_cast<PlaylistItem *>(currentItem()));
} }
void Playlist::clear() void Playlist::clear()
...@@ -1075,11 +1075,16 @@ bool Playlist::canDecode(QMimeSource *s) ...@@ -1075,11 +1075,16 @@ bool Playlist::canDecode(QMimeSource *s)
return K3URLDrag::decode(s, urls) && !urls.isEmpty(); return K3URLDrag::decode(s, urls) && !urls.isEmpty();
} }
void Playlist::decode(QMimeSource *s, PlaylistItem *item) void Playlist::decode(const QMimeData *s, PlaylistItem *item)
{ {
KUrl::List urls; KUrl::List urls;
if(!K3URLDrag::decode(s, urls) || urls.isEmpty()) if(!KUrl::List::canDecode(s))
return;
urls = KUrl::List::fromMimeData(s);
if(urls.isEmpty())
return; return;
// handle dropped images // handle dropped images
...@@ -1237,7 +1242,7 @@ void Playlist::contentsDropEvent(QDropEvent *e) ...@@ -1237,7 +1242,7 @@ void Playlist::contentsDropEvent(QDropEvent *e)
} }
} }
else else
decode(e, item); decode(e->mimeData(), item);
m_blockDataChanged = false; m_blockDataChanged = false;
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <QDragEnterEvent> #include <QDragEnterEvent>
#include <QMouseEvent> #include <QMouseEvent>
#include <QCustomEvent> #include <QCustomEvent>
#include <QMimeData>
#include "covermanager.h" #include "covermanager.h"
#include "stringhash.h" #include "stringhash.h"
...@@ -433,7 +434,7 @@ protected: ...@@ -433,7 +434,7 @@ protected:
virtual Q3DragObject *dragObject(QWidget *parent); virtual Q3DragObject *dragObject(QWidget *parent);
virtual Q3DragObject *dragObject() { return dragObject(this); } virtual Q3DragObject *dragObject() { return dragObject(this); }
virtual bool canDecode(QMimeSource *s); virtual bool canDecode(QMimeSource *s);
virtual void decode(QMimeSource *s, PlaylistItem *item = 0); virtual void decode(const QMimeData *s, PlaylistItem *item = 0);
virtual void contentsDropEvent(QDropEvent *e); virtual void contentsDropEvent(QDropEvent *e);
virtual void contentsMouseDoubleClickEvent(QMouseEvent *e); virtual void contentsMouseDoubleClickEvent(QMouseEvent *e);
virtual void contentsDragEnterEvent(QDragEnterEvent *e); virtual void contentsDragEnterEvent(QDragEnterEvent *e);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment