Fixed show/hide bug while window locked

This commit is contained in:
tengel 2024-03-20 09:22:23 -05:00
parent 0ebfae4da2
commit 9bae66a55b
3 changed files with 21 additions and 2 deletions

View file

@ -66,6 +66,8 @@ public:
/** handy way to flip all the flags at once */
void setModified(bool modified = true);
/** flips menus in locking situation */
void setLocked();
protected:
/** save general Options like all bar positions and status as well as the geometry and the recent file list to the configuration
@ -224,3 +226,4 @@ private:

View file

@ -7,7 +7,10 @@
#include "kpasman.h"
#include "kpasentrydlg.h"
KpasmanView::KpasmanView(QWidget *parent, const char* name) : QListView(parent, name){
KpasmanView::KpasmanView(QWidget *parent, const char* name) : QListView(parent, name)
{
m_parent = (KpasmanApp*)parent;
setBackgroundMode( PaletteBase );
setAllColumnsShowFocus(true);
@ -54,6 +57,12 @@ void KpasmanView::hidePassword(bool mode)
}
void KpasmanView::lockWindow(bool mode)
{
lockWindowMode(mode);
m_parent->setLocked();
}
void KpasmanView::lockWindowMode(bool mode)
{
if (mode && !m_bLocked) {
if (getDocument()->lock()) {
@ -180,3 +189,5 @@ void KpasmanView::mousePressEvent(QMouseEvent* event)
}

View file

@ -10,6 +10,7 @@
#include <qlistview.h>
#include <qwidget.h>
class KpasmanApp;
class KpasmanDoc;
/** The KpasmanView class provides the view widget for the KpasmanApp instance.
@ -47,6 +48,7 @@ public:
/** locks/unlocks the window */
void lockWindow(bool mode);
void lockWindowMode(bool mode);
/** returns if window is locked */
bool isLocked() {return m_bLocked;};
@ -72,6 +74,7 @@ protected:
void mousePressEvent(QMouseEvent* event);
private:
KpasmanApp* m_parent;
/** stores password column number */
int m_iPWColumn;
/** stores whether or not the password column is "hidden" */
@ -86,3 +89,5 @@ private:
#endif // KPASMANVIEW_H