summaryrefslogtreecommitdiffstats
path: root/juk/directorylist.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commite2de64d6f1beb9e492daf5b886e19933c1fa41dd (patch)
tree9047cf9e6b5c43878d5bf82660adae77ceee097a /juk/directorylist.cpp
downloadtdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.tar.gz
tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'juk/directorylist.cpp')
-rw-r--r--juk/directorylist.cpp101
1 files changed, 101 insertions, 0 deletions
diff --git a/juk/directorylist.cpp b/juk/directorylist.cpp
new file mode 100644
index 00000000..1e53cac8
--- /dev/null
+++ b/juk/directorylist.cpp
@@ -0,0 +1,101 @@
+/***************************************************************************
+ begin : Tue Feb 4 2003
+ copyright : (C) 2003 - 2004 by Scott Wheeler
+ email : wheeler@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 *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <kfiledialog.h>
+#include <klocale.h>
+#include <klistview.h>
+#include <kpushbutton.h>
+
+#include <qcheckbox.h>
+
+#include "directorylistbase.h"
+#include "directorylist.h"
+
+////////////////////////////////////////////////////////////////////////////////
+// public methods
+////////////////////////////////////////////////////////////////////////////////
+
+DirectoryList::DirectoryList(const QStringList &directories, bool importPlaylists,
+ QWidget *parent, const char *name) :
+ KDialogBase(parent, name, true, i18n("Folder List"), Ok | Cancel, Ok, true),
+ m_dirList(directories),
+ m_importPlaylists(importPlaylists)
+{
+ m_base = new DirectoryListBase(this);
+
+ setMainWidget(m_base);
+
+ m_base->directoryListView->setFullWidth(true);
+
+ connect(m_base->addDirectoryButton, SIGNAL(clicked()),
+ SLOT(slotAddDirectory()));
+ connect(m_base->removeDirectoryButton, SIGNAL(clicked()),
+ SLOT(slotRemoveDirectory()));
+
+ QStringList::ConstIterator it = directories.begin();
+ for(; it != directories.end(); ++it)
+ new KListViewItem(m_base->directoryListView, *it);
+
+ m_base->importPlaylistsCheckBox->setChecked(importPlaylists);
+
+ QSize sz = sizeHint();
+ setMinimumSize(kMax(350, sz.width()), kMax(250, sz.height()));
+ resize(sizeHint());
+}
+
+DirectoryList::~DirectoryList()
+{
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// public slots
+////////////////////////////////////////////////////////////////////////////////
+
+DirectoryList::Result DirectoryList::exec()
+{
+ m_result.status = static_cast<DialogCode>(KDialogBase::exec());
+ m_result.addPlaylists = m_base->importPlaylistsCheckBox->isChecked();
+ return m_result;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// private slots
+////////////////////////////////////////////////////////////////////////////////
+
+void DirectoryList::slotAddDirectory()
+{
+ QString dir = KFileDialog::getExistingDirectory();
+ if(!dir.isEmpty() && m_dirList.find(dir) == m_dirList.end()) {
+ m_dirList.append(dir);
+ new KListViewItem(m_base->directoryListView, dir);
+ m_result.addedDirs.append(dir);
+ }
+}
+
+void DirectoryList::slotRemoveDirectory()
+{
+ if(!m_base->directoryListView->selectedItem())
+ return;
+
+ QString dir = m_base->directoryListView->selectedItem()->text(0);
+ m_dirList.remove(dir);
+ m_result.removedDirs.append(dir);
+ delete m_base->directoryListView->selectedItem();
+}
+
+#include "directorylist.moc"
+
+// vim: ts=8