1.8.5
This commit is contained in:
parent
2414f8bb2d
commit
cbf1e8db8f
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||
* Copyright 2020 David Xanatos, xanasoft.com
|
||||
* Copyright 2020-2023 David Xanatos, xanasoft.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -32,6 +32,12 @@
|
|||
#include "core/drv/api_defs.h"
|
||||
#include "core/svc/InteractiveWire.h"
|
||||
|
||||
#define PATTERN XPATTERN
|
||||
#define _MY_POOL_H // prevent inclusion of pool.h by pattern.h
|
||||
typedef void *POOL;
|
||||
#include "common/list.h"
|
||||
#include "common/pattern.h"
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Structures and Types
|
||||
|
@ -50,8 +56,8 @@ struct MsgEntry {
|
|||
struct HideEntry {
|
||||
|
||||
ULONG code;
|
||||
CString detail;
|
||||
|
||||
//CString detail;
|
||||
PATTERN* pattern;
|
||||
};
|
||||
|
||||
|
||||
|
@ -175,8 +181,10 @@ void CMessageDialog::ReloadConf()
|
|||
}
|
||||
|
||||
int pos = head.Find(L',');
|
||||
if (pos != -1)
|
||||
entry->detail = head.Mid(pos + 1);
|
||||
if (pos != -1) {
|
||||
//entry->detail = head.Mid(pos + 1);
|
||||
entry->pattern = Pattern_Create(NULL, head.Mid(pos + 1), TRUE, 0);
|
||||
}
|
||||
|
||||
if (entry->code)
|
||||
m_hidden.Add(entry);
|
||||
|
@ -222,8 +230,11 @@ BOOL CMessageDialog::IsHiddenMessage(
|
|||
if (entry->code == code) {
|
||||
if (entry->code == MSG_1319) // hide MSG_1319 for all detail
|
||||
return TRUE;
|
||||
BOOL match = (! entry->detail.GetLength()) ||
|
||||
(entry->detail.CompareNoCase(detail_1) == 0);
|
||||
//BOOL match = (! entry->detail.GetLength()) ||
|
||||
// (entry->detail.CompareNoCase(detail_1) == 0);
|
||||
CString Detail_1 = detail_1;
|
||||
Detail_1.MakeLower();
|
||||
BOOL match = Pattern_Match(entry->pattern, Detail_1, Detail_1.GetLength());
|
||||
if (match)
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -77,8 +77,11 @@ public:
|
|||
});
|
||||
|
||||
connect(pBox, qOverload<int>(&QComboBox::currentIndexChanged), [pBox](int index){
|
||||
if (index != -1)
|
||||
pBox->setProperty("value", pBox->itemData(index));
|
||||
if (index != -1) {
|
||||
QString Program = pBox->itemData(index).toString();
|
||||
pBox->setProperty("value", Program);
|
||||
pBox->lineEdit()->setReadOnly(Program.left(1) == "<");
|
||||
}
|
||||
});
|
||||
|
||||
return pBox;
|
||||
|
@ -96,6 +99,7 @@ public:
|
|||
QString Program = pItem->data(index.column(), Qt::UserRole).toString();
|
||||
|
||||
pBox->setProperty("value", Program);
|
||||
pBox->lineEdit()->setReadOnly(Program.left(1) == "<");
|
||||
|
||||
int Index = pBox->findData(Program);
|
||||
pBox->setCurrentIndex(Index);
|
||||
|
@ -107,10 +111,11 @@ public:
|
|||
}
|
||||
|
||||
virtual void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const {
|
||||
QTreeWidgetItem* pItem = ((QTreeWidgetHacker*)m_pTree)->itemFromIndex(index);
|
||||
|
||||
QComboBox* pBox = qobject_cast<QComboBox*>(editor);
|
||||
if (pBox) {
|
||||
QTreeWidgetItem* pItem = ((QTreeWidgetHacker*)m_pTree)->itemFromIndex(index);
|
||||
|
||||
QString Value = pBox->property("value").toString();
|
||||
pItem->setText(index.column(), pBox->currentText());
|
||||
//QString Text = pBox->currentText();
|
||||
|
@ -120,7 +125,6 @@ public:
|
|||
|
||||
QLineEdit* pEdit = qobject_cast<QLineEdit*>(editor);
|
||||
if (pEdit) {
|
||||
QTreeWidgetItem* pItem = ((QTreeWidgetHacker*)m_pTree)->itemFromIndex(index);
|
||||
pItem->setText(index.column(), pEdit->text());
|
||||
QString Value = pEdit->text();
|
||||
if (m_Group) Value = "<" + Value + ">";
|
||||
|
@ -128,6 +132,13 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
QSize size = QStyledItemDelegate::sizeHint(option, index);
|
||||
if(size.height() < 20) size.setHeight(20); // ensure enough room for teh combo box
|
||||
return size;
|
||||
}
|
||||
|
||||
protected:
|
||||
COptionsWindow* m_pOptions;
|
||||
QTreeWidget* m_pTree;
|
||||
|
|
|
@ -11,6 +11,8 @@ bool CPopUpWindow__DarkMode = false;
|
|||
|
||||
CPopUpWindow::CPopUpWindow(QWidget* parent) : QMainWindow(parent)
|
||||
{
|
||||
m_HideAllMessages = false;
|
||||
|
||||
Qt::WindowFlags flags = windowFlags();
|
||||
flags |= Qt::CustomizeWindowHint;
|
||||
//flags &= ~Qt::WindowContextHelpButtonHint;
|
||||
|
@ -185,7 +187,15 @@ void CPopUpWindow::ReloadHiddenMessages()
|
|||
QStringList HiddenMessages = theAPI->GetUserSettings()->GetTextList("SbieCtrl_HideMessage", true);
|
||||
foreach(const QString& HiddenMessage, HiddenMessages)
|
||||
{
|
||||
if (HiddenMessage == "*") {
|
||||
m_HideAllMessages = true;
|
||||
m_HiddenMessages.clear();
|
||||
break;
|
||||
}
|
||||
|
||||
StrPair CodeDetail = Split2(HiddenMessage, ",");
|
||||
if (CodeDetail.first.left(4) == "SBIE" || CodeDetail.first.left(4) == "SBOX")
|
||||
CodeDetail.first = CodeDetail.first.mid(4);
|
||||
m_HiddenMessages.insert(CodeDetail.first.toInt(), CodeDetail.second);
|
||||
}
|
||||
}
|
||||
|
@ -221,9 +231,16 @@ void CPopUpWindow::OnHideMessage()
|
|||
|
||||
bool CPopUpWindow::IsMessageHidden(quint32 MsgCode, const QStringList& MsgData)
|
||||
{
|
||||
if (m_HideAllMessages)
|
||||
return true;
|
||||
|
||||
foreach(const QString& Details, m_HiddenMessages.values(MsgCode & 0xFFFF))
|
||||
{
|
||||
if(Details.isEmpty() || (MsgData.size() >= 2 && Details.compare(MsgData[1]) == 0))
|
||||
if(Details.isEmpty())
|
||||
return true;
|
||||
|
||||
QRegularExpression exp("^" + QRegularExpression::escape(Details).replace("\\*",".*").replace("\\?","."));
|
||||
if(MsgData.size() >= 2 && exp.match(MsgData[1]).hasMatch())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -456,6 +456,7 @@ protected:
|
|||
virtual void SendPromptResult(CPopUpPrompt* pEntry, int retval);
|
||||
|
||||
QMultiMap<quint32, QString> m_HiddenMessages;
|
||||
bool m_HideAllMessages;
|
||||
|
||||
private:
|
||||
bool m_ResetPosition;
|
||||
|
|
Loading…
Reference in New Issue