Rename upload and delete classes and variables to be more meaningful.
Uploader:: -> PopupUpload Deleter:: -> PopupDelete K7Main::m_uploader -> K7Main::m_popupUpload K7Main::m_deleter -> K7Main::m_popupDelete
This commit is contained in:
36
K7Main.cpp
36
K7Main.cpp
@@ -58,7 +58,7 @@ K7Main::K7Main(const WEnvironment& env)
|
||||
OwnerTrustLevel[GpgME::Key::OwnerTrust::Ultimate] = TR("UidUltimate");
|
||||
OwnerTrustLevel[GpgME::Key::OwnerTrust::Undefined] = TR("UidUndefined");
|
||||
OwnerTrustLevel[GpgME::Key::OwnerTrust::Unknown] = TR("UidUnknown");
|
||||
m_uploader = NULL; m_deleter = NULL;
|
||||
m_popupUpload = NULL; m_popupDelete = NULL;
|
||||
m_keyEdit = new KeyEdit(this);
|
||||
|
||||
WLink link;
|
||||
@@ -70,7 +70,7 @@ K7Main::K7Main(const WEnvironment& env)
|
||||
|
||||
K7Main::~K7Main()
|
||||
{
|
||||
delete m_config; delete m_uploader; delete m_deleter;
|
||||
delete m_config; delete m_popupUpload; delete m_popupDelete;
|
||||
delete m_keyEdit; delete m_popupCreate;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ K7Main::Create()
|
||||
m_btnUpload = new WPushButton(TR("Upload"));
|
||||
m_btnUpload->setToolTip(TR("TTTUpload"));
|
||||
vblButtons->addWidget(unique_ptr<WPushButton> (m_btnUpload));
|
||||
m_btnUpload->clicked().connect(this, &K7Main::PopupUploader);
|
||||
m_btnUpload->clicked().connect(this, &K7Main::ShowPopupUpload);
|
||||
m_btnImport = new WPushButton(TR("Import"));
|
||||
m_btnImport->setToolTip(TR("TTTImport"));
|
||||
vblButtons->addWidget(unique_ptr<WPushButton> (m_btnImport));
|
||||
@@ -135,7 +135,7 @@ K7Main::Create()
|
||||
m_btnDelete = new WPushButton(TR("Delete"));
|
||||
m_btnDelete->setToolTip(TR("TTTDelete"));
|
||||
vblButtons->addWidget(unique_ptr<WPushButton> (m_btnDelete));
|
||||
m_btnDelete->clicked().connect(this, &K7Main::PopupDeleter);
|
||||
m_btnDelete->clicked().connect(this, &K7Main::ShowPopupDelete);
|
||||
m_btnDelete->hide();
|
||||
}
|
||||
vblButtons->addSpacing(150);
|
||||
@@ -413,20 +413,20 @@ void K7Main::DisplaySubKeys(const WString& fullKeyID, bool secret)
|
||||
m_ttbSubKeys->show();
|
||||
}
|
||||
|
||||
void K7Main::PopupUploader() {
|
||||
if (m_uploader == NULL) {
|
||||
m_uploader = new Uploader(m_btnUpload, m_tmwMessage);
|
||||
m_uploader->Create();
|
||||
m_uploader->UploadDone().connect(this, &K7Main::OnUploadCompleted);
|
||||
void K7Main::ShowPopupUpload() {
|
||||
if (m_popupUpload == NULL) {
|
||||
m_popupUpload = new PopupUpload(m_btnUpload, m_tmwMessage);
|
||||
m_popupUpload->Create();
|
||||
m_popupUpload->UploadDone().connect(this, &K7Main::OnUploadCompleted);
|
||||
}
|
||||
m_uploader->show();
|
||||
m_popupUpload->show();
|
||||
}
|
||||
|
||||
void K7Main::OnUploadCompleted(const WString& spool) {
|
||||
// Buffer the spool file name in the import button
|
||||
m_btnImport->setAttributeValue("spool", spool);
|
||||
m_btnImport->show();
|
||||
m_uploader->hide();
|
||||
m_popupUpload->hide();
|
||||
}
|
||||
|
||||
void K7Main::DoImportKey() {
|
||||
@@ -490,13 +490,13 @@ bool K7Main::CanKeyBeDeleted(const WString& fullKeyID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void K7Main::PopupDeleter() {
|
||||
if (m_deleter == NULL) {
|
||||
m_deleter = new Deleter(m_btnDelete, m_tmwMessage);
|
||||
m_deleter->Create();
|
||||
m_deleter->GetDeleteButton()->clicked().connect(this, &K7Main::DoDeleteKey);
|
||||
void K7Main::ShowPopupDelete() {
|
||||
if (m_popupDelete == NULL) {
|
||||
m_popupDelete = new PopupDelete(m_btnDelete, m_tmwMessage);
|
||||
m_popupDelete->Create();
|
||||
m_popupDelete->GetDeleteButton()->clicked().connect(this, &K7Main::DoDeleteKey);
|
||||
}
|
||||
m_deleter->show();
|
||||
m_popupDelete->show();
|
||||
}
|
||||
|
||||
void K7Main::DoDeleteKey() {
|
||||
@@ -524,7 +524,7 @@ void K7Main::DoDeleteKey() {
|
||||
m_tmwMessage->SetText(TR("DeleteSuccess") + fpr + WString(" - ") + WString(k.userID(0).name()));
|
||||
}
|
||||
m_btnDelete->hide();
|
||||
m_deleter->hide();
|
||||
m_popupDelete->hide();
|
||||
if (secret)
|
||||
m_config->UpdateSecretKeyOwnership(fpr, false);
|
||||
// Show that the key is no longer available
|
||||
|
||||
8
K7Main.h
8
K7Main.h
@@ -59,8 +59,8 @@ private:
|
||||
WTreeTable * m_ttbKeys;
|
||||
WTreeTable * m_ttbUids;
|
||||
WTreeTable * m_ttbSubKeys;
|
||||
Uploader * m_uploader;
|
||||
Deleter * m_deleter;
|
||||
PopupUpload * m_popupUpload;
|
||||
PopupDelete * m_popupDelete;
|
||||
KeyEdit * m_keyEdit;
|
||||
PopupCreate * m_popupCreate;
|
||||
/**
|
||||
@@ -94,7 +94,7 @@ private:
|
||||
* Shows a non-blocking popup to upload a key,
|
||||
* with forward confirmation for upload.
|
||||
*/
|
||||
void PopupUploader();
|
||||
void ShowPopupUpload();
|
||||
/**
|
||||
* Shows a button to import an uploaded key
|
||||
* @param spool
|
||||
@@ -107,7 +107,7 @@ private:
|
||||
/**
|
||||
* Shows a non-blocking popup to delete a key
|
||||
*/
|
||||
void PopupDeleter();
|
||||
void ShowPopupDelete();
|
||||
/**
|
||||
* All public keys can be deleted.
|
||||
* Private keys can be deleted only if the user
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
Deleter::Deleter(WWidget * anchorWidget, TransientMessageWidget * txtMessage, const WLength& width)
|
||||
PopupDelete::PopupDelete(WWidget * anchorWidget, TransientMessageWidget * txtMessage, const WLength& width)
|
||||
: WPopupWidget(cpp14::make_unique<WContainerWidget>()) {
|
||||
m_tmwMessage = txtMessage; m_cwMain = NULL; m_cbConfirm = NULL;
|
||||
m_cbReConfirm = NULL; m_btnDelete = NULL;
|
||||
@@ -23,10 +23,10 @@ Deleter::Deleter(WWidget * anchorWidget, TransientMessageWidget * txtMessage, co
|
||||
setWidth(width);
|
||||
}
|
||||
|
||||
Deleter::~Deleter() {
|
||||
PopupDelete::~PopupDelete() {
|
||||
}
|
||||
|
||||
void Deleter::Create() {
|
||||
void PopupDelete::Create() {
|
||||
m_cwMain = static_cast<WContainerWidget*> (implementation());
|
||||
// White in css file, like default background color.
|
||||
m_cwMain->setStyleClass("popup");
|
||||
@@ -40,12 +40,12 @@ void Deleter::Create() {
|
||||
vblMain->addWidget(unique_ptr<WPushButton> (m_btnDelete));
|
||||
m_cbReConfirm->hide();
|
||||
m_btnDelete->hide();
|
||||
m_cbConfirm->changed().connect(this, &Deleter::OnCbConfirm);
|
||||
m_cbReConfirm->changed().connect(this, &Deleter::OnCbReConfirm);
|
||||
this->hidden().connect(this, &Deleter::Reset);
|
||||
m_cbConfirm->changed().connect(this, &PopupDelete::OnCbConfirm);
|
||||
m_cbReConfirm->changed().connect(this, &PopupDelete::OnCbReConfirm);
|
||||
this->hidden().connect(this, &PopupDelete::Reset);
|
||||
}
|
||||
|
||||
void Deleter::Reset() {
|
||||
void PopupDelete::Reset() {
|
||||
m_btnDelete->hide();
|
||||
m_cbReConfirm->setUnChecked();
|
||||
m_cbReConfirm->hide();
|
||||
@@ -53,12 +53,12 @@ void Deleter::Reset() {
|
||||
m_cbConfirm->show();
|
||||
}
|
||||
|
||||
void Deleter::OnCbConfirm() {
|
||||
void PopupDelete::OnCbConfirm() {
|
||||
m_cbReConfirm->setHidden(m_cbConfirm->checkState() != CheckState::Checked);
|
||||
m_cbReConfirm->setUnChecked();
|
||||
m_btnDelete->setHidden(m_cbReConfirm->checkState() != CheckState::Checked);
|
||||
}
|
||||
|
||||
void Deleter::OnCbReConfirm() {
|
||||
void PopupDelete::OnCbReConfirm() {
|
||||
m_btnDelete->setHidden(m_cbReConfirm->checkState() != CheckState::Checked);
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ using namespace Wt;
|
||||
* A transient popup window with a forward confirmation
|
||||
* before deleting a key.
|
||||
*/
|
||||
class Deleter : public WPopupWidget {
|
||||
class PopupDelete : public WPopupWidget {
|
||||
public:
|
||||
Deleter(WWidget * anchorWidget, TransientMessageWidget * txtMessage, const WLength& width = 350);
|
||||
virtual ~Deleter();
|
||||
PopupDelete(WWidget * anchorWidget, TransientMessageWidget * txtMessage, const WLength& width = 350);
|
||||
virtual ~PopupDelete();
|
||||
void Create();
|
||||
/**
|
||||
* Caller can bind the delete function to this button.
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
Uploader::Uploader(WWidget * anchorWidget, TransientMessageWidget * txtMessage, const WLength& width)
|
||||
PopupUpload::PopupUpload(WWidget * anchorWidget, TransientMessageWidget * txtMessage, const WLength& width)
|
||||
: WPopupWidget(cpp14::make_unique<WContainerWidget>()) {
|
||||
m_tmwMessage = txtMessage; m_upload = NULL; m_cwMain = NULL;
|
||||
m_cbConfirm = NULL; m_cbReConfirm = NULL; m_btnUpload = NULL;
|
||||
@@ -23,10 +23,10 @@ Uploader::Uploader(WWidget * anchorWidget, TransientMessageWidget * txtMessage,
|
||||
setWidth(width);
|
||||
}
|
||||
|
||||
Uploader::~Uploader() {
|
||||
PopupUpload::~PopupUpload() {
|
||||
}
|
||||
|
||||
void Uploader::Create() {
|
||||
void PopupUpload::Create() {
|
||||
m_upload = new WFileUpload();
|
||||
m_upload->setFileTextSize(10240); // Is really approximate
|
||||
m_upload->setMultiple(false);
|
||||
@@ -45,16 +45,16 @@ void Uploader::Create() {
|
||||
m_cbReConfirm->hide();
|
||||
m_cbConfirm->hide();
|
||||
m_btnUpload->hide();
|
||||
m_cbConfirm->changed().connect(this, &Uploader::OnCbConfirm);
|
||||
m_cbReConfirm->changed().connect(this, &Uploader::OnCbReConfirm);
|
||||
m_btnUpload->clicked().connect(this, &Uploader::DoUpload);
|
||||
m_upload->uploaded().connect(this, &Uploader::OnUploadDone);
|
||||
m_upload->fileTooLarge().connect(this, &Uploader::OnFileTooLarge);
|
||||
m_upload->changed().connect(this, &Uploader::Reset);
|
||||
this->hidden().connect(this, &Uploader::Reset);
|
||||
m_cbConfirm->changed().connect(this, &PopupUpload::OnCbConfirm);
|
||||
m_cbReConfirm->changed().connect(this, &PopupUpload::OnCbReConfirm);
|
||||
m_btnUpload->clicked().connect(this, &PopupUpload::DoUpload);
|
||||
m_upload->uploaded().connect(this, &PopupUpload::OnUploadDone);
|
||||
m_upload->fileTooLarge().connect(this, &PopupUpload::OnFileTooLarge);
|
||||
m_upload->changed().connect(this, &PopupUpload::Reset);
|
||||
this->hidden().connect(this, &PopupUpload::Reset);
|
||||
}
|
||||
|
||||
void Uploader::Reset() {
|
||||
void PopupUpload::Reset() {
|
||||
m_btnUpload->hide();
|
||||
m_cbReConfirm->setUnChecked();
|
||||
m_cbReConfirm->hide();
|
||||
@@ -62,17 +62,17 @@ void Uploader::Reset() {
|
||||
m_cbConfirm->show();
|
||||
m_btnUpload->enable();
|
||||
}
|
||||
void Uploader::OnCbConfirm() {
|
||||
void PopupUpload::OnCbConfirm() {
|
||||
m_cbReConfirm->setHidden(m_cbConfirm->checkState() != CheckState::Checked);
|
||||
m_cbReConfirm->setUnChecked();
|
||||
m_btnUpload->setHidden(m_cbReConfirm->checkState() != CheckState::Checked);
|
||||
}
|
||||
|
||||
void Uploader::OnCbReConfirm() {
|
||||
void PopupUpload::OnCbReConfirm() {
|
||||
m_btnUpload->setHidden(m_cbReConfirm->checkState() != CheckState::Checked);
|
||||
}
|
||||
|
||||
void Uploader::DoUpload() {
|
||||
void PopupUpload::DoUpload() {
|
||||
if (m_upload->canUpload()) {
|
||||
m_btnUpload->disable();
|
||||
m_upload->upload();
|
||||
@@ -81,12 +81,12 @@ void Uploader::DoUpload() {
|
||||
}
|
||||
}
|
||||
|
||||
void Uploader::OnUploadDone() {
|
||||
void PopupUpload::OnUploadDone() {
|
||||
m_sigUploadDone.emit(m_upload->spoolFileName());
|
||||
m_btnUpload->enable();
|
||||
}
|
||||
|
||||
void Uploader::OnFileTooLarge() {
|
||||
void PopupUpload::OnFileTooLarge() {
|
||||
m_tmwMessage->SetText(TR("FileTooLarge"));
|
||||
m_btnUpload->enable();
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ using namespace Wt;
|
||||
* @param txtMessage
|
||||
* @param width
|
||||
*/
|
||||
class Uploader : public WPopupWidget
|
||||
class PopupUpload : public WPopupWidget
|
||||
{
|
||||
public:
|
||||
Uploader(WWidget * anchorWidget, TransientMessageWidget * txtMessage, const WLength& width = 350);
|
||||
virtual ~Uploader();
|
||||
PopupUpload(WWidget * anchorWidget, TransientMessageWidget * txtMessage, const WLength& width = 350);
|
||||
virtual ~PopupUpload();
|
||||
void Create();
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user