This commit is contained in:
DavidXanatos 2023-08-09 08:52:47 +02:00
parent 850167c2c8
commit 0cd6167cce
2 changed files with 23 additions and 9 deletions

View File

@ -1868,8 +1868,12 @@ void CSbieView::UpdateStartMenu(CSandBoxPlus* pBoxEx)
QMenu* pMenu = GetMenuFolder(Link.Folder, m_pMenuRunStart, m_MenuFolders); QMenu* pMenu = GetMenuFolder(Link.Folder, m_pMenuRunStart, m_MenuFolders);
QAction* pAction = pMenu->addAction(Link.Name, this, SLOT(OnSandBoxAction())); QAction* pAction = pMenu->addAction(Link.Name, this, SLOT(OnSandBoxAction()));
QIcon Icon = LoadWindowsIcon(Link.Icon, Link.IconIndex); QIcon Icon;
if(Icon.isNull()) Icon = m_IconProvider.icon(QFileInfo(Link.Target)); if (!Link.Icon.isEmpty())
Icon = LoadWindowsIcon(Link.Icon, Link.IconIndex);
else if (Link.Target.contains("://"))
Icon = theGUI->GetIcon("Internet");
if (Icon.isNull()) Icon = m_IconProvider.icon(QFileInfo(Link.Target));
pAction->setIcon(Icon); pAction->setIcon(Icon);
QString Command; QString Command;
if(Link.Target.contains(" ")) if(Link.Target.contains(" "))
@ -1879,7 +1883,7 @@ void CSbieView::UpdateStartMenu(CSandBoxPlus* pBoxEx)
if(!Link.Arguments.isEmpty()) if(!Link.Arguments.isEmpty())
Command += " " + Link.Arguments; Command += " " + Link.Arguments;
pAction->setData(Command); pAction->setData(Command);
pAction->setProperty("Icon", Link.Icon.isEmpty() ? pBoxEx->GetCommandFile(Command) : Link.Icon); if(!Link.Icon.isEmpty()) pAction->setProperty("Icon", Link.Icon);
pAction->setProperty("IconIndex", Link.IconIndex); pAction->setProperty("IconIndex", Link.IconIndex);
pAction->setProperty("WorkingDir", Link.WorkDir); pAction->setProperty("WorkingDir", Link.WorkDir);
} }
@ -1909,12 +1913,16 @@ void CSbieView::UpdateRunMenu(const CSandBoxPtr& pBox)
StrPair FileIndex = Split2(Entry["Icon"].toString(), ",", true); StrPair FileIndex = Split2(Entry["Icon"].toString(), ",", true);
QString CmdFile = pBoxEx->GetCommandFile(Entry["Command"].toString());
QString IconFile; QString IconFile;
int IconIndex = 0; int IconIndex = 0;
if (FileIndex.first.isEmpty()) if (FileIndex.first.isEmpty()) {
IconFile = pBoxEx->GetCommandFile(Entry["Command"].toString()); if (!CmdFile.contains("://"))
IconFile = CmdFile;
}
else if (FileIndex.second.isEmpty()) { else if (FileIndex.second.isEmpty()) {
IconFile = pBoxEx->GetCommandFile(Entry["Command"].toString()); IconFile = CmdFile;
IconIndex = FileIndex.first.toInt(); IconIndex = FileIndex.first.toInt();
} }
else { else {
@ -1923,7 +1931,13 @@ void CSbieView::UpdateRunMenu(const CSandBoxPtr& pBox)
} }
QAction* pAction = pMenu->addAction(FolderName.second, this, SLOT(OnSandBoxAction())); QAction* pAction = pMenu->addAction(FolderName.second, this, SLOT(OnSandBoxAction()));
pAction->setIcon(LoadWindowsIcon(IconFile, IconIndex)); QIcon Icon;
if (!IconFile.isEmpty())
Icon = LoadWindowsIcon(IconFile, IconIndex);
else if (CmdFile.contains("://"))
Icon = theGUI->GetIcon("Internet");
if (Icon.isNull()) Icon = m_IconProvider.icon(QFileInfo(CmdFile));
pAction->setIcon(Icon);
pAction->setData(Entry["Command"].toString()); pAction->setData(Entry["Command"].toString());
pAction->setProperty("Icon", IconFile); pAction->setProperty("Icon", IconFile);
pAction->setProperty("IconIndex", IconIndex); pAction->setProperty("IconIndex", IconIndex);

View File

@ -2,8 +2,8 @@
#define VERSION_MJR 1 #define VERSION_MJR 1
#define VERSION_MIN 10 #define VERSION_MIN 10
#define VERSION_REV 4 #define VERSION_REV 3
#define VERSION_UPD 0 #define VERSION_UPD 1
#ifndef STR #ifndef STR
#define STR2(X) #X #define STR2(X) #X