mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-19 01:37:17 +01:00
see #2139 show warning dialog and offer choice: open file for veiwing read-only or cancel
This commit is contained in:
parent
25fa09d626
commit
da776105be
2
VERSION
2
VERSION
@ -7,7 +7,7 @@ FWB_MICRO_VERSION=0
|
||||
# build number is like "nano" version number. I am incrementing build
|
||||
# number during development cycle
|
||||
#
|
||||
BUILD_NUM="3485"
|
||||
BUILD_NUM="3486"
|
||||
|
||||
VERSION="$FWB_MAJOR_VERSION.$FWB_MINOR_VERSION.$FWB_MICRO_VERSION.$BUILD_NUM"
|
||||
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
#define VERSION "4.2.0.3485"
|
||||
#define VERSION "4.2.0.3486"
|
||||
#define GENERATION "4.2"
|
||||
|
||||
@ -1,3 +1,11 @@
|
||||
2011-02-24 vadim <vadim@netcitadel.com>
|
||||
|
||||
* AddressTableEditor.cpp (load): fixes #2139 "Provide "Cancel"
|
||||
button if Address Table file is read-only". IF the file configured
|
||||
with Address Table object is read-only, the GUI shows warning when
|
||||
user clicks "Edit" button and offers a choice: open it for viewing
|
||||
read-only or cancel.
|
||||
|
||||
2011-02-23 vadim <vadim@netcitadel.com>
|
||||
|
||||
* AddressTableEditor.cpp (save): fixes #2135 "Editing table
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
|
||||
%define name fwbuilder
|
||||
%define version 4.2.0.3485
|
||||
%define version 4.2.0.3486
|
||||
%define release 1
|
||||
|
||||
%if "%_vendor" == "MandrakeSoft"
|
||||
|
||||
@ -4,6 +4,6 @@ Replaces: fwbuilder (<=4.1.1-1), fwbuilder-common, fwbuilder-bsd, fwbuilder-linu
|
||||
Priority: extra
|
||||
Section: checkinstall
|
||||
Maintainer: vadim@fwbuilder.org
|
||||
Version: 4.2.0.3485-1
|
||||
Version: 4.2.0.3486-1
|
||||
Depends: libqt4-gui (>= 4.3.0), libxml2, libxslt1.1, libsnmp | libsnmp15
|
||||
Description: Firewall Builder GUI and policy compilers
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
|
||||
%define name fwbuilder
|
||||
%define version 4.2.0.3485
|
||||
%define version 4.2.0.3486
|
||||
%define release 1
|
||||
|
||||
%if "%_vendor" == "MandrakeSoft"
|
||||
|
||||
@ -173,6 +173,7 @@ void AddressTableDialog::editFile( void )
|
||||
{
|
||||
QString filePath = m_dialog->filename->text();
|
||||
AddressTableEditor editor(this, filePath);
|
||||
editor.exec(); // its modal dialog
|
||||
if (editor.load())
|
||||
editor.exec(); // its modal dialog
|
||||
}
|
||||
|
||||
|
||||
@ -52,6 +52,10 @@ AddressTableEditor::AddressTableEditor(QWidget *parent,
|
||||
m_dialog->setupUi(static_cast<QDialog*>(this));
|
||||
|
||||
if (!title.isEmpty()) setWindowTitle(title);
|
||||
}
|
||||
|
||||
bool AddressTableEditor::load()
|
||||
{
|
||||
|
||||
QFile rf(file_name);
|
||||
if (rf.exists())
|
||||
@ -60,18 +64,25 @@ AddressTableEditor::AddressTableEditor(QWidget *parent,
|
||||
QObject::tr("File %1 not found").arg(file_name)
|
||||
);
|
||||
}
|
||||
|
||||
QFileInfo fi(file_name);
|
||||
if ( ! fi.isWritable())
|
||||
{
|
||||
QMessageBox::critical(
|
||||
this, "Firewall Builder",
|
||||
tr("The file is read-only, you can't save the changes."),
|
||||
tr("&Continue"), QString::null, QString::null, 0, 0 );
|
||||
switch (
|
||||
QMessageBox::critical(
|
||||
this, "Firewall Builder",
|
||||
tr("The file is read-only, you can't save the changes."),
|
||||
tr("&View the file"), tr("&Cancel"), QString::null, 0, 1 ))
|
||||
{
|
||||
case 0: // open read-only
|
||||
m_dialog->editor->setReadOnly(true);
|
||||
m_dialog->ok_button->hide();
|
||||
m_dialog->cancel_button->setText(tr("Close"));
|
||||
break;
|
||||
|
||||
m_dialog->editor->setReadOnly(true);
|
||||
|
||||
m_dialog->ok_button->hide();
|
||||
m_dialog->cancel_button->setText(tr("Close"));
|
||||
default: // cancel
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (rf.open(QIODevice::ReadOnly))
|
||||
@ -84,6 +95,7 @@ AddressTableEditor::AddressTableEditor(QWidget *parent,
|
||||
m_dialog->editor->setPlainText(rf.errorString());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
AddressTableEditor::~AddressTableEditor()
|
||||
|
||||
@ -42,6 +42,9 @@ class AddressTableEditor : public QDialog
|
||||
const QString &title="");
|
||||
~AddressTableEditor();
|
||||
|
||||
// load data, return true if successful
|
||||
bool load();
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent *ev);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user