File indexing completed on 2024-10-06 04:25:58
0001 /* 0002 SPDX-FileCopyrightText: 2010 Michal Malek <michalm@jabster.pl> 0003 SPDX-FileCopyrightText: 1998-2007 Sebastian Trueg <trueg@k3b.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef _K3B_DATA_PROJECT_INTERFACE_H_ 0009 #define _K3B_DATA_PROJECT_INTERFACE_H_ 0010 0011 #include "k3bprojectinterface.h" 0012 0013 #include <QStringList> 0014 0015 0016 namespace K3b { 0017 class DataDoc; 0018 0019 class DataProjectInterface : public ProjectInterface 0020 { 0021 Q_OBJECT 0022 Q_CLASSINFO( "D-Bus Interface", "org.k3b.DataProject" ) 0023 0024 public: 0025 explicit DataProjectInterface( DataDoc* doc, const QString& dbusPath = QString() ); 0026 0027 public Q_SLOTS: 0028 /** 0029 * Create a new folder in the root of the doc. 0030 * This is the same as calling createFolder( name, "/" ) 0031 */ 0032 bool createFolder( const QString& name ); 0033 0034 /** 0035 * Create a new folder with name @p name in the folder with the 0036 * absolute path @p dir. 0037 * 0038 * \return true if the folder was created successfully, false if 0039 * an item with the same name already exists or the dir 0040 * directory could not be found. 0041 * 0042 * Example: createFolder( "test", "/foo/bar" ) will create the 0043 * folder /foo/bar/test. 0044 */ 0045 bool createFolder( const QString& name, const QString& dir ); 0046 0047 /** 0048 * Add urls to a specific folder in the project. 0049 * 0050 * Example: addUrl( "test.txt", "/foo/bar" ) will add the file test.txt 0051 * to folder /foo/bar. 0052 */ 0053 void addUrl( const QString& url, const QString& dir ); 0054 0055 void addUrls( const QStringList& urls, const QString& dir ); 0056 0057 /** 0058 * Remove an item 0059 * \return true if the item was successfully removed. 0060 */ 0061 bool removeItem( const QString& path ); 0062 0063 /** 0064 * Rename an item 0065 * \return true if the item was successfully renamed, false if 0066 * no item could be found at \p path, \p newName is empty, 0067 * or the item cannot be renamed for some reason. 0068 */ 0069 bool renameItem( const QString& path, const QString& newName ); 0070 0071 /** 0072 * Set the volume ID of the data project. This is the name shown by Windows 0073 * when the CD is inserted. 0074 */ 0075 void setVolumeID( const QString& id ); 0076 0077 /** 0078 * \return true if the specified path exists in the project and it is a folder. 0079 */ 0080 bool isFolder( const QString& path ) const; 0081 0082 /** 0083 * \return the names of the child elements of the item determined by path. 0084 */ 0085 QStringList children( const QString& path ) const; 0086 0087 /** 0088 * Set the sort weight of an item 0089 * \return false if the item at \p could not be found. 0090 */ 0091 bool setSortWeight( const QString& path, long weight ) const; 0092 0093 private: 0094 DataDoc* m_dataDoc; 0095 }; 0096 } 0097 0098 #endif