2 Copyright (C) 2010-2023 Ben Kibbey <bjk@luxsci.net>
4 This file is part of qpwmc.
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
22 #include "pwmdSaveDialog.h"
24 PwmdSaveDialog::PwmdSaveDialog (Pwmd
*handle
, bool newFile
, QWidget
*p
) :
28 QSettings
cfg ("qpwmc");
29 restoreGeometry (cfg
.value ("saveDialogGeometry").toByteArray ());
30 setWindowFlags (Qt::WindowTitleHint
);
31 ui
.saveWidget
->setParent (this);
32 ui
.saveWidget
->setHandle (handle
, newFile
);
34 QPushButton
*pb
= ui
.buttonBox
->button (QDialogButtonBox::Reset
);
35 pb
->disconnect (this);
36 pb
->setHidden (false);
37 connect (pb
, SIGNAL (clicked ()), ui
.saveWidget
, SLOT (slotResetRecipients ()));
38 disconnect(ui
.buttonBox
, SIGNAL(accepted()), this, SLOT(accept()));
40 pb
= ui
.buttonBox
->button (QDialogButtonBox::Save
);
41 connect (pb
, SIGNAL (clicked ()), this, SLOT (slotAccepted ()));
42 pb
->setEnabled (false);
43 connect (ui
.saveWidget
, SIGNAL (saveReady (bool)), this,
44 SLOT (slotSaveReady (bool)));
47 PwmdSaveDialog::~PwmdSaveDialog ()
49 QSettings
cfg ("qpwmc");
51 cfg
.setValue ("saveDialogGeometry", saveGeometry ());
55 PwmdSaveDialog::slotSaveReady (bool b
)
57 QPushButton
*pb
= ui
.buttonBox
->button (QDialogButtonBox::Save
);
62 PwmdSaveDialog::slotAccepted ()
64 if (ui
.saveWidget
->isSearching ())
67 gpg_error_t rc
= ui
.saveWidget
->save ();
74 PwmdSaveDialog::widget()