Commit 3b6ff5c4 authored by camilo higuita's avatar camilo higuita

from the filebrowser update the iocn when its color is selected to anotehr one:

parent 0e94efa0
......@@ -470,7 +470,7 @@ Maui.Page
onItemRightClicked:
{
if(currentFMList.pathType !== Maui.FMList.TRASH_PATH)
itemMenu.show(control.currentFMList.get(index), index)
itemMenu.show(index)
control.itemRightClicked(index)
}
......@@ -1031,7 +1031,7 @@ Maui.Page
function refresh()
{
var pos = browser.contentY
control.currentFMList.refresh()
// control.currentFMList.refresh()
browser.contentY = pos
}
......
......@@ -119,33 +119,32 @@ Menu
}
}
MenuSeparator{}
MenuSeparator{ visible: colorBar.visible }
MenuItem
{
{
width: parent.width
height: visible ? iconSize + space.big : 0
visible: isDir
Maui.ColorsBar
{
id: colorBar
visible: parent.visible
anchors.centerIn: parent
id: colorBar
size: iconSize
onColorPicked:
{
currentFMList.setDirIcon(control.item.path, color)
refresh()
}
onColorPicked: currentFMList.setDirIcon(index, color)
}
}
function show(item, index)
{
function show(index)
{
control.item = currentFMList.get(index)
if(item)
{
control.index = index
isDir = Maui.FM.isDir(item.path)
control.item = item
popup()
}
}
......
......@@ -647,7 +647,7 @@ namespace FMH
KConfig file(path.toLocalFile(), KConfig::SimpleConfig);
auto kgroup = file.group(group);
kgroup.writeEntry(key, value);
file.reparseConfiguration();
// file.reparseConfiguration();
file.sync();
#endif
}
......
......@@ -253,9 +253,7 @@ void FMList::reset()
break;
}
case FMList::PATHTYPE::TRASH_PATH:
case FMList::PATHTYPE::DRIVES_PATH:
break;
default: break;
}
if(this->saveDirProps)
......@@ -666,13 +664,20 @@ void FMList::cutInto(const QVariantList& files)
// }
}
void FMList::setDirIcon(const QUrl& path, const QString &iconName)
void FMList::setDirIcon(const int &index, const QString &iconName)
{
qDebug()<< "setting dir icon to "<< path << iconName;
if(index >= this->list.size() || index < 0)
return;
const auto path = QUrl(this->list.at(index)[FMH::MODEL_KEY::PATH]);
if(!FM::isDir(path))
return;
FMH::setDirConf(path.toString()+"/.directory", "Desktop Entry", "Icon", iconName);
// QFile file(path.toLocalFile());
// file.open(QIODevice::WriteOnly);
// file.close();
this->list[index][FMH::MODEL_KEY::ICON] = iconName;
emit this->updateModel(index, QVector<int> {FMH::MODEL_KEY::ICON});
}
QString FMList::getParentPath()
......
......@@ -215,7 +215,7 @@ public slots:
void copyInto(const QVariantList &files);
void cutInto(const QVariantList &files);
static void setDirIcon(const QUrl& path, const QString &iconName);
void setDirIcon(const int &index, const QString &iconName);
signals:
void pathChanged();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment