35 ProfileItem(QString name, QString reference, StatusType status,
bool isGlobal,
bool fromGlobal,
bool isImport);
37 const QString& getName()
const {
return name_; }
38 const QString getType()
const;
39 const QString& getAutoSwitchFilter()
const {
return autoSwitchFilter_; }
40 StatusType getStatus()
const {
return status_; }
41 bool isGlobal()
const {
return isGlobal_; }
42 bool isFromGlobal()
const {
return fromGlobal_; }
43 bool isChanged()
const {
return isChanged_; }
44 bool isDefault()
const;
45 bool isImport()
const {
return isImport_; }
46 bool isDeleted()
const {
return setForDeletion_; }
48 const QString& getReference()
const {
return reference_; }
53 QString getProfilePath(QString profileName =
"")
const;
55 void setName(QString value);
56 void setStatus(StatusType status) {status_ = status; }
57 void setAutoSwitchFilter(QString value);
58 void setForDeletion() { setForDeletion_ =
true; }
64 QString autoSwitchFilter_ =
"";
66 bool fromGlobal_ =
false;
67 bool isImport_ =
false;
68 bool setForDeletion_ =
false;
73 bool isChanged_ =
false;
90 void setFilterType(FilterType ft);
91 void setFilterString(QString txt = QString());
93 static QStringList filterTypes();
96 virtual bool lessThan(
const QModelIndex &source_left,
const QModelIndex &source_right)
const;
97 virtual bool filterAcceptsRow(
int source_row,
const QModelIndex &source_parent)
const;
115 COL_AUTO_SWITCH_FILTER,
120 DATA_IS_DEFAULT = Qt::UserRole,
127 virtual int rowCount(
const QModelIndex & parent = QModelIndex())
const;
128 virtual int columnCount(
const QModelIndex & parent = QModelIndex())
const;
129 virtual QVariant data(
const QModelIndex & idx,
int role = Qt::DisplayRole)
const;
130 virtual bool setData(
const QModelIndex &index,
const QVariant &value,
int role);
131 virtual QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole)
const;
132 virtual Qt::ItemFlags flags(
const QModelIndex &index)
const;
134 void deleteEntries(QModelIndexList idcs);
135 bool restoreEntries(QModelIndexList idcs);
137 int findByName(
const QString& name);
138 QModelIndex addNewProfile(QString name);
139 QModelIndex duplicateEntry(QModelIndex idx, ProfileItem::StatusType status = ProfileItem::StatusType::Copy);
141 QModelIndex activeProfile()
const;
143 bool userProfilesExist()
const;
145 bool isDataValid(QString& err);
147#if defined(HAVE_MINIZIP) || defined(HAVE_MINIZIPNG)
148 bool exportProfiles(QString filename, QModelIndexList items, QString& err);
149 void importProfilesFromZip(QString filename,
int& skippedCnt, QStringList& importList);
151 void importProfilesFromDir(QString filename,
int& skippedCnt, QStringList& importList,
bool fromZip =
false);
153 static bool checkNameValidity(QString name, QString& msg);
154 QList<int> findAllByNameAndVisibility(
const QString& name,
bool isGlobal =
false,
bool searchReference =
false)
const;
156 bool checkDuplicate(
const QModelIndex &index,
bool isOriginalToDuplicate =
false)
const;
160 const ProfileItem* getCurrentProfile()
const {
return current_profile_; }
161 const ProfileItem* getProfile(
int index)
const {
return profile_items_[index]; }
162 const ProfileItem* getPersonalProfile(
const QString& name);
164 QVariant dataPath(
const QModelIndex& idx, QString& profilePath)
const;
167 static QString illegalCharacters();
169 QModelIndex addNewProfile(QString name, QString reference,
bool isGlobal =
false,
bool fromGlobal =
false,
bool isImport =
false);
172 QList<ProfileItem*> profile_items_;
173 QStringList profile_files_;
176 int findByNameAndVisibility(
const QString& name,
bool isGlobal =
false,
bool searchReference =
false)
const;
178#if defined(HAVE_MINIZIP) || defined(HAVE_MINIZIPNG)
179 static bool acceptFile(QString fileName,
int fileSize);
180 static QString cleanName(QString fileName);
183 QVariant dataDisplay(
const QModelIndex & idx)
const;
184 QVariant dataFontRole(
const QModelIndex & idx)
const;
185 QVariant dataBackgroundRole(
const QModelIndex & idx)
const;
186 QVariant dataForegroundRole(
const QModelIndex & idx)
const;
187 QVariant dataToolTipRole(
const QModelIndex & idx)
const;
189#if defined(HAVE_MINIZIP) || defined(HAVE_MINIZIPNG)
190 QStringList exportFileList(QModelIndexList items);
192 bool copyTempToProfile(QString tempPath, QString profilePath,
bool& wasEmpty);
193 QFileInfoList filterProfilePath(QString, QFileInfoList ent,
bool fromZip);
194 QFileInfoList uniquePaths(QFileInfoList lst);