summaryrefslogtreecommitdiffstats
path: root/digikam/digikam/syncjob.h
blob: 0143b21641410fb7558a781b80a2d96c73b18d51 (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
/* ============================================================
 *
 * This file is a part of digiKam project
 * http://www.digikam.org
 *
 * Date        : 2004-10-04
 * Description : sync IO jobs.
 * 
 * Copyright (C) 2004 by Renchi Raju <renchi@pooh.tam.uiuc.edu>
 *
 * Concept copied from tdelibs/kio/kio/netaccess.h/cpp
 *   This file is part of the KDE libraries
 *   Copyright (C) 1997 Torben Weis (weis@kde.org)
 *   Copyright (C) 1998 Matthias Ettrich (ettrich@kde.org)
 *   Copyright (C) 1999 David Faure (faure@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, 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 SYNCJOB_H
#define SYNCJOB_H

// TQt includes.

#include <tqobject.h>
#include <tqpixmap.h>

// KDE includes.

#include <kurl.h>

class TQString;

namespace TDEIO
{
class Job;
}

namespace Digikam
{

class Album;
class TAlbum;

class SyncJob : public TQObject
{
    Q_OBJECT

public:

    /* this will delete the urls. */
    static bool del(const KURL::List& urls, bool useTrash);

    /* remove this when we move dependency upto kde 3.2 */
    static bool file_move(const KURL &src, const KURL &dest);

    /* Load the image or icon for the tag thumbnail */    
    static TQPixmap getTagThumbnail(TAlbum *album);
    static TQPixmap getTagThumbnail(const TQString &name, int size);

    static TQString lastErrorMsg();
    static int     lastErrorCode();
    
private:

    SyncJob();
    ~SyncJob();

    bool delPriv(const KURL::List& urls);
    bool trashPriv(const KURL::List& urls);

    bool fileMovePriv(const KURL &src, const KURL &dest);
    
    TQPixmap getTagThumbnailPriv(TAlbum *album);
    TQPixmap getTagThumbnailPriv(const TQString &name, int size);

    void enter_loop();
    
    static int      lastErrorCode_;
    static TQString* lastErrorMsg_;
    bool            success_;
    
    TQPixmap         *thumbnail_;
    Album           *album_;
    int             thumbnailSize_;

private slots:

    void slotResult( TDEIO::Job * job );
    void slotGotThumbnailFromIcon(Album *album, const TQPixmap& pix);
    void slotLoadThumbnailFailed(Album *album);
    void slotGotThumbnailFromIcon(const KURL& url, const TQPixmap& pix);
    void slotLoadThumbnailFailed();
};

}  // namespace Digikam

#endif /* SYNCJOB_H */