File indexing completed on 2021-12-21 13:15:45

0001 /***************************************************************************
0002 *   Copyright 2007 Niko Sams <niko.sams@gmail.com>                        *
0003 *                                                                         *
0004 *   This program is free software; you can redistribute it and/or modify  *
0005 *   it under the terms of the GNU General Public License as published by  *
0006 *   the Free Software Foundation; either version 2 of the License, or     *
0007 *   (at your option) any later version.                                   *
0008 *                                                                         *
0009 ***************************************************************************/
0010 
0011 #ifndef UPLOADPROFILEMODEL_H
0012 #define UPLOADPROFILEMODEL_H
0013 
0014 #include <QStandardItemModel>
0015 
0016 namespace KDevelop {
0017     class IProject;
0018 }
0019 class UploadProfileItem;
0020 
0021 /**
0022  * Model for upload-profiles.
0023  */
0024 class UploadProfileModel : public QStandardItemModel
0025 {
0026     Q_OBJECT
0027 public:
0028     UploadProfileModel(QObject* parent = nullptr);
0029     ~UploadProfileModel() override {}
0030 
0031     /**
0032      * Removes an upload item
0033      */
0034     bool removeRow(int row, const QModelIndex & parent = QModelIndex());
0035 
0036     /**
0037      * Convenience function that returns a casted profile-item for a row.
0038      */
0039     UploadProfileItem* uploadItem(int row, int column = 0) const;
0040     /**
0041      * Convenience function that returns a casted profile-item for an index.
0042      */
0043     UploadProfileItem* uploadItem(const QModelIndex& index) const;
0044 
0045     /**
0046      * Set the Project for this model
0047      */
0048     void setProject(KDevelop::IProject* project);
0049     /**
0050      * Returns the project used for this model
0051      */
0052     KDevelop::IProject* project();
0053 
0054     /**
0055      * Reverts all changes made to the model
0056      */
0057     void revert() override;
0058 
0059     /**
0060      * Saves all changes made to the model in the config
0061      */
0062     bool submit() override;
0063 
0064 private:
0065     KDevelop::IProject* m_project; ///< the project
0066     QStringList m_deltedProfileNrs; ///< deleted profiles
0067 };
0068 
0069 
0070 #endif
0071 // kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on