summaryrefslogtreecommitdiffstats
path: root/digikam/libs/dialogs/deletedialog.h
blob: 16ab9f8912410949731c7b0cf85d0db34f91bbe9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/* ============================================================
 *
 * This file is a part of digiKam project
 * http://www.digikam.org
 *
 * Date        : 2005-05-07
 * Description : a dialog to delete item.
 * 
 * Copyright (C) 2004 by Michael Pyne <michael.pyne@kdemail.net>
 * Copyright (C) 2006 by Ian Monroe <ian@monroe.nu>
 * Copyright (C) 2006-2007 by Marcel Wiesweg <marcel.wiesweg@gmx.de>
 *
 * 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, or (at your option)
 * any later version.
 * 
 * This program 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 General Public License for more details.
 * 
 * ============================================================ */

#ifndef _DELETEDIALOG_H
#define _DELETEDIALOG_H

// TQt includes.

#include <tqcheckbox.h>

// KDE includes.

#include <kdialogbase.h>
#include <kurl.h>

// Local includes.

#include "digikam_export.h"
#include "deletedialogbase.h"

class TQStringList;
class TDEListBox;
class KGuiItem;
class TQLabel;
class TQWidgetStack;

namespace Digikam
{

namespace DeleteDialogMode
{
    enum ListMode
    {
        Files,
        Albums,
        Subalbums
    };

    enum DeleteMode
    {
        NoChoiceTrash, // "Do not show again" checkbox, does not show if config entry is set
        NoChoiceDeletePermanently, // No checkbox
        UserPreference, // Checkbox to toggle trash/permanent, preset to user's last preference
        UseTrash, // same beckbox as above, preset to trash
        DeletePermanently // same checkbox as above, preset to permanent
    };
}

class DeleteWidget : public DeleteDialogBase
{
    TQ_OBJECT
  

public:

    DeleteWidget(TQWidget *parent = 0, const char *name = 0);

    void setFiles(const KURL::List &files);
    void setListMode(DeleteDialogMode::ListMode mode);
    void setDeleteMode(DeleteDialogMode::DeleteMode deleteMode);

protected slots:

    void slotShouldDelete(bool shouldDelete);

protected:

    void updateText();
    DeleteDialogMode::ListMode m_listMode;
    DeleteDialogMode::DeleteMode m_deleteMode;
};

class DIGIKAM_EXPORT DeleteDialog : public KDialogBase
{
    TQ_OBJECT
  

public:

    enum Mode
    {
        ModeFiles,
        ModeAlbums,
        ModeSubalbums
    };

public:

    DeleteDialog(TQWidget *parent, const char *name = "delete_dialog");

    bool confirmDeleteList(const KURL::List &condemnedURLs,
                           DeleteDialogMode::ListMode listMode,
                           DeleteDialogMode::DeleteMode deleteMode);
    bool shouldDelete() const { return m_widget->ddShouldDelete->isChecked(); }

    void setURLs(const KURL::List &files);
    void presetDeleteMode(DeleteDialogMode::DeleteMode mode);
    void setListMode(DeleteDialogMode::ListMode mode);

protected slots:

    virtual void accept();
    void slotShouldDelete(bool shouldDelete);

private:

    bool          m_saveShouldDeleteUserPreference;
    bool          m_saveDoNotShowAgain;

    KGuiItem      m_trashGuiItem;

    DeleteWidget *m_widget;
};

} // namespace Digikam

#endif // _DELETEDIALOG_H