mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-19 10:20:17 -06:00
dbhub: Use different icon for user's directory
This commit is contained in:
@@ -110,6 +110,13 @@ RemoteModel::~RemoteModel()
|
||||
|
||||
void RemoteModel::setNewRootDir(const QString& url, const QString& cert)
|
||||
{
|
||||
// Extract user name
|
||||
QString cn = remoteDatabase.clientCertificates()[cert].subjectInfo(QSslCertificate::CommonName).at(0);
|
||||
QStringList cn_parts = cn.split("@");
|
||||
if(cn_parts.size() < 2)
|
||||
return;
|
||||
currentUserName = cn_parts.first();
|
||||
|
||||
// Save settings
|
||||
currentRootDirectory = url;
|
||||
currentClientCert = cert;
|
||||
@@ -194,7 +201,9 @@ QVariant RemoteModel::data(const QModelIndex& index, int role) const
|
||||
if(role == Qt::DecorationRole && index.column() == 0)
|
||||
{
|
||||
// Use different icons depending on item type
|
||||
if(type == "folder")
|
||||
if(type == "folder" && index.parent() == QModelIndex() && item->value(RemoteModelColumnName) == currentUserName)
|
||||
return QImage(":/icons/folder_user");
|
||||
else if(type == "folder")
|
||||
return QImage(":/icons/folder");
|
||||
else if(type == "database")
|
||||
return QImage(":/icons/database");
|
||||
|
||||
@@ -105,6 +105,7 @@ private:
|
||||
// lazy population.
|
||||
QString currentRootDirectory;
|
||||
QString currentClientCert;
|
||||
QString currentUserName;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
BIN
src/icons/folder_user.png
Normal file
BIN
src/icons/folder_user.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 730 B |
@@ -55,5 +55,6 @@
|
||||
<file>database.png</file>
|
||||
<file>cog_go.png</file>
|
||||
<file alias="paste">page_paste.png</file>
|
||||
<file>folder_user.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
Reference in New Issue
Block a user