summaryrefslogtreecommitdiffstats
path: root/src/tdeioslave/digikamalbums.h
blob: c75e8c9cf9518b782b9abd3e50068ad8e01c00fe (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        : 2005-04-21
 * Description : a dio-slave to process file operations on 
 *               digiKam albums.
 *
 * Copyright (C) 2005 by Renchi Raju <renchi@pooh.tam.uiuc.edu>
 *
 * Lots of the file io code is copied from KDE file tdeioslave.
 * Copyright for the KDE file tdeioslave follows:
 *  Copyright (C) 2000-2002 Stephan Kulow <coolo@kde.org>
 *  Copyright (C) 2000-2002 David Faure <faure@kde.org>
 *  Copyright (C) 2000-2002 Waldo Bastian <bastian@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 DIGIKAMALBUMS_H
#define DIGIKAMALBUMS_H

// TQt includes.

#include <tqvaluelist.h>
#include <tqdatetime.h>
#include <sqlitedb.h>

// KDE includes.

#include <tdeio/slavebase.h>

class TQStringList;

class AlbumInfo
{
public:

    int      id;
    TQ_LLONG  icon;
    TQString  url;
    TQString  caption;
    TQString  collection;
    TQDate    date;
};        
    
class tdeio_digikamalbums : public TDEIO::SlaveBase
{

public:

    tdeio_digikamalbums(const TQCString &pool_socket,
                      const TQCString &app_socket);
    ~tdeio_digikamalbums();

    void special(const TQByteArray& data);

    void get( const KURL& url );
    void put( const KURL& url, int _mode, bool _overwrite, bool _resume );
    void copy( const KURL &src, const KURL &dest, int mode, bool overwrite );
    void rename( const KURL &src, const KURL &dest, bool overwrite );

    void stat( const KURL& url );
    void listDir( const KURL& url );
    void mkdir( const KURL& url, int permissions );
    void chmod( const KURL& url, int permissions );
    void del( const KURL& url, bool isfile);         
    
private:

    bool createUDSEntry(const TQString& path, TDEIO::UDSEntry& entry);
    void createDigikamPropsUDSEntry(TDEIO::UDSEntry& entry);

    void       buildAlbumList();
    AlbumInfo  findAlbum(const TQString& url, bool addIfNotExists=true);
    void       delAlbum(int albumID);
    void       renameAlbum(const TQString& oldURL, const TQString& newURL);
    bool       findImage(int albumID, const TQString& name) const;
    void       addImage(int albumID, const TQString& filePath);
    void       delImage(int albumID, const TQString& name);
    void       renameImage(int oldAlbumID, const TQString& oldName,
                           int newAlbumID, const TQString& newName);
    void       copyImage(int srcAlbumID, const TQString& srcName,
                         int dstAlbumID, const TQString& dstName);

    void       scanAlbum(const TQString& url);
    void       scanOneAlbum(const TQString& url);
    void       removeInvalidAlbums();
    
private:

    SqliteDB              m_sqlDB;
    TQString               m_libraryPath;
    TQValueList<AlbumInfo> m_albumList;
};


#endif /* DIGIKAMALBUMS_H */