Commit c88279a3 authored by Michael Pyne's avatar Michael Pyne

Add new file removal dialog, with the major feature being that the Delete...

Add new file removal dialog, with the major feature being that the Delete button is no longer the default.

Also, the big warning icon is bigger, with bold text around the "permanently removed" part. ;-)

Just for the hell of it I threw in a number of files selected label, after beating my head on KDialogBase for 5 hours or so. :-(

Files are still moved to the trash instead of being deleted at this point, as I will probably tweak this some more tomorrow.

svn path=/trunk/kdemultimedia/juk/; revision=343130
parent f875e725
......@@ -7,6 +7,8 @@ juk_SOURCES = \
artsplayer.cpp \
cache.cpp \
collectionlist.cpp \
deletedialog.cpp \
deletedialogbase.ui \
directorylist.cpp \
directorylistbase.ui \
dynamicplaylist.cpp \
......
/***************************************************************************
begin : Tue Aug 31 21:59:58 EST 2004
copyright : (C) 2004 by Michael Pyne
email : michael.pyne@kdemail.net
***************************************************************************/
/***************************************************************************
* *
* 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 <kdialogbase.h>
#include <kglobal.h>
#include <kstdguiitem.h>
#include <klocale.h>
#include <kiconloader.h>
#include <qstringlist.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qvbox.h>
#include <qhbox.h>
#include "deletedialog.h"
DeleteDialog::DeleteDialog(QWidget *parent, const char *name)
: DeleteDialogBase(parent, name)
{
layout()->setSpacing(KDialog::spacingHint());
ddWarningIcon->setPixmap(KGlobal::iconLoader()->loadIcon("messagebox_warning",
KIcon::Desktop, KIcon::SizeLarge));
}
void DeleteDialog::setFiles(const QStringList &files)
{
ddFileList->clear();
ddFileList->insertStringList(files);
ddNumFiles->setText(i18n("<b>1</b> file selected.", "<b>%n</b> files selected.", files.count()));
}
bool DeleteDialog::confirmDeleteList(QWidget *parent, const QStringList &condemnedFiles)
{
KDialogBase base(KDialogBase::Plain, WStyle_DialogBorder, parent, "delete_dialog",
true /* modal */, i18n("About to delete selected files"), KDialogBase::Ok |
KDialogBase::Cancel, KDialogBase::Cancel /* Default */, true /* separator */);
QWidget *page = base.plainPage();
QVBoxLayout *layout = new QVBoxLayout(page);
DeleteDialog *widget = new DeleteDialog(page);
layout->addWidget(widget);
widget->setFiles(condemnedFiles);
base.setMinimumSize(410, 324);
base.adjustSize();
base.setButtonGuiItem(KDialogBase::Ok, KStdGuiItem::del());
return base.exec() == QDialog::Accepted;
}
// vim: set et ts=4 sw=4:
/***************************************************************************
begin : Tue Aug 31 21:54:20 EST 2004
copyright : (C) 2004 by Michael Pyne
email : michael.pyne@kdemail.net
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#ifndef _DELETEDIALOG_H
#define _DELETEDIALOG_H
#include "deletedialogbase.h"
class QStringList;
class DeleteDialog : public DeleteDialogBase
{
public:
DeleteDialog(QWidget *parent = 0, const char *name = 0);
void setFiles(const QStringList &files);
static bool confirmDeleteList(QWidget *parent, const QStringList &condemnedFiles);
};
#endif
// vim: set et ts=4 sw=4:
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>DeleteDialogBase</class>
<widget class="QWidget">
<property name="name">
<cstring>DeleteDialogBase</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>493</width>
<height>473</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>420</width>
<height>320</height>
</size>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout3</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>ddWarningIcon</cstring>
</property>
<property name="text">
<string>Replace me</string>
</property>
</widget>
<widget class="QLabel">
<property name="name">
<cstring>ddWarningLabel</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;qt&gt;&lt;p&gt;Are you sure that you want to delete these items?&lt;/p&gt;
&lt;p&gt;Deleting these items will &lt;b&gt;permanently remove&lt;/b&gt; them!&lt;/p&gt;&lt;/qt&gt;</string>
</property>
<property name="alignment">
<set>WordBreak|AlignCenter</set>
</property>
</widget>
</hbox>
</widget>
<widget class="KListBox">
<property name="name">
<cstring>ddFileList</cstring>
</property>
<property name="selectionMode">
<enum>NoSelection</enum>
</property>
<property name="toolTip" stdset="0">
<string>List of files that are about to be deleted.</string>
</property>
<property name="whatsThis" stdset="0">
<string>This is the list of items that are about to be deleted.</string>
</property>
</widget>
<widget class="QLabel">
<property name="name">
<cstring>ddNumFiles</cstring>
</property>
<property name="text">
<string>Placeholder for number of files</string>
</property>
<property name="alignment">
<set>AlignVCenter|AlignRight</set>
</property>
</widget>
</vbox>
</widget>
<customwidgets>
</customwidgets>
<layoutdefaults spacing="6" margin="11"/>
<includehints>
<includehint>klistbox.h</includehint>
</includehints>
</UI>
......@@ -54,6 +54,7 @@
#include "k3bexporter.h"
#include "painteater.h"
#include "upcomingplaylist.h"
#include "deletedialog.h"
using namespace ActionCollection;
......@@ -746,7 +747,7 @@ void Playlist::removeFromDisk(const PlaylistItemList &items)
else
message = i18n("Do you really want to move these %1 items to the trash?").arg(QString::number(files.count()));
if(KMessageBox::warningContinueCancelList(this, message, files, i18n("Delete Items?"), KGuiItem(i18n("&Delete"),"editdelete")) == KMessageBox::Continue) {
if(DeleteDialog::confirmDeleteList(this, files)) {
for(PlaylistItemList::ConstIterator it = items.begin(); it != items.end(); ++it) {
if(m_playingItem == *it)
action("forward")->activate();
......
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