Exemplo n.º 1
0
/*****************************************
 *Function: SetLimitTime::SetLimitTime
 *Brief: SetLimitTime类的构造函数
 *Param: QWidget *parent    父窗口指针
 *Author: LiuBing
 *Data: 2013.11.22
*****************************************/
SetLimitTime::SetLimitTime(QWidget *parent)
    :QWidget(parent)
{
    client_password_label = new QLabel("客户编码:",this);
    client_password_label->setGeometry(LEFT_MARGIN,TOP_MARGIN,70,20);

    client_password_edit = new QLineEdit(this);
    client_password_edit->setGeometry(LEFT_MARGIN + 70,TOP_MARGIN,MAIN_LENGTH - 2 * LEFT_MARGIN - 70 - 50 - HORIZONTAL_STRECH,20);
    client_password_edit->setEchoMode(QLineEdit::Password);
    client_password_edit->setMaxLength(CLIENT_PASSWORD_LENGTH);
    QRegExp regx("[0-9A-Za-z]+$");
    QValidator *validator = new QRegExpValidator(regx,client_password_edit);
    client_password_edit->setValidator(validator);

    client_password_hint_label = new QLabel("(妥善保管,严防泄漏、丢失)",this);
    client_password_hint_label->setGeometry(LEFT_MARGIN + 70,TOP_MARGIN + 20 + VERTICAL_STRECH,client_password_edit->width(),20);
    plain_code_checkbox = new QCheckBox("明码",this);
    plain_code_checkbox->setGeometry(MAIN_LENGTH - 50 - RIGHT_MARGIN,TOP_MARGIN,50,20);
    connect(plain_code_checkbox,SIGNAL(toggled(bool)),this,SLOT(setClientPasswordEcho(bool)));

    set_limit_time_group = new QGroupBox("限时保护设置",this);
    set_limit_time_group->setGeometry(LEFT_MARGIN,TOP_MARGIN + 40 + 2 * VERTICAL_STRECH,MAIN_LENGTH - 2 * LEFT_MARGIN,
                                      MAIN_WIDTH - (TOP_MARGIN + 40 + 2 * VERTICAL_STRECH) - 10 - BASE_MARGIN);

    service_time_label = new QLabel("允许使用时间:",set_limit_time_group);
    service_time_label->setGeometry((set_limit_time_group->width() - 250) / 2,VERTICAL_STRECH * 2,100,20);
    service_time_day_label = new QLabel("天",set_limit_time_group);
    service_time_day_label->setGeometry((set_limit_time_group->width() - 250) / 2 + 150,VERTICAL_STRECH * 2,25,20);
    service_time_day_label->setAlignment(Qt::AlignCenter);
    service_time_hour_label = new QLabel("小时",set_limit_time_group);
    service_time_hour_label->setGeometry((set_limit_time_group->width() - 250) / 2 + 225,VERTICAL_STRECH * 2,25,20);
    service_time_hour_label->setAlignment(Qt::AlignCenter);
    service_time_day_edit = new TimeEdit(DayType,set_limit_time_group);
    service_time_day_edit->setGeometry((set_limit_time_group->width() - 250) / 2 + 100,VERTICAL_STRECH * 2,50,20);
    service_time_hour_edit = new TimeEdit(HourType,set_limit_time_group);
    service_time_hour_edit->setGeometry((set_limit_time_group->width() - 250) / 2 + 175,VERTICAL_STRECH * 2,50,20);

    early_warning_time_label = new QLabel("提前报警时间:",set_limit_time_group);
    early_warning_time_label->setGeometry((set_limit_time_group->width() - 250) / 2,VERTICAL_STRECH * 3 + 20,100,20);
    early_warning_day_label = new QLabel("天",set_limit_time_group);
    early_warning_day_label->setGeometry((set_limit_time_group->width() - 250) / 2 + 150,VERTICAL_STRECH * 3 + 20,25,20);
    early_warning_day_label->setAlignment(Qt::AlignCenter);
    //early_warning_hour_label = new QLabel("小时",set_limit_time_group);
    //early_warning_hour_label->setGeometry((set_limit_time_group->width() - 250) / 2 + 225,VERTICAL_STRECH * 5 + 20,25,20);
    //early_warning_hour_label->setAlignment(Qt::AlignCenter);
    early_warning_day_edit = new TimeEdit(DayType,set_limit_time_group);
    early_warning_day_edit->setGeometry((set_limit_time_group->width() - 250) / 2 + 100,VERTICAL_STRECH * 3 + 20,50,20);
    //early_warning_hour_edit = new TimeEdit(HourType,set_limit_time_group);
    //early_warning_hour_edit->setGeometry((set_limit_time_group->width() - 250) / 2 + 175,VERTICAL_STRECH * 5 + 20,50,20);

    radio_file_mode = new QRadioButton("文件加密",set_limit_time_group);
    radio_file_mode->setGeometry(HORIZONTAL_STRECH,VERTICAL_STRECH * 4 + 40,80,20);
    radio_file_mode->setChecked(true);
    build_file_button = new QPushButton("生成设置文件",set_limit_time_group);
    build_file_button->setGeometry(HORIZONTAL_STRECH + 90,VERTICAL_STRECH * 4 + 40,90,20);

    radio_key_mode = new QRadioButton("密码加密",set_limit_time_group);
    radio_key_mode->setGeometry(HORIZONTAL_STRECH,VERTICAL_STRECH * 5 + 60,80,20);
    key_mode_label = new QLabel("请输入验证码:",set_limit_time_group);
    key_mode_label->setGeometry(HORIZONTAL_STRECH + 90,VERTICAL_STRECH * 5 + 60,80,20);
    key_edit = new QLineEdit(set_limit_time_group);
    key_edit->setGeometry(HORIZONTAL_STRECH + 90 + 80,VERTICAL_STRECH * 5 + 60,120,20);
    key_edit->setEnabled(false);
    QRegExp number_regx("[0-9]+$");
    QValidator *number_validator = new QRegExpValidator(number_regx);
    key_edit->setValidator(number_validator);
    key_edit->setMaxLength(6);

    build_password_btn = new QPushButton("生成密码",set_limit_time_group);
    build_password_btn->setGeometry(HORIZONTAL_STRECH,VERTICAL_STRECH * 6 + 80,80,20);
    build_password_btn->setEnabled(false);
    password_edit = new QLineEdit(set_limit_time_group);
    password_edit->setGeometry(HORIZONTAL_STRECH + 90,VERTICAL_STRECH * 6 + 80,160,20);
    password_edit->setEnabled(false);
    copy_btn = new QPushButton("复制",set_limit_time_group);
    copy_btn->setGeometry(HORIZONTAL_STRECH + 260,VERTICAL_STRECH * 6 + 80,40,20);

    connect(build_file_button,SIGNAL(clicked()),this,SLOT(buildFileButtonSlot()));
    connect(build_password_btn,SIGNAL(clicked()),this,SLOT(buildPasswordSlot()));

    connect(radio_file_mode,SIGNAL(toggled(bool)),build_file_button,SLOT(setEnabled(bool)));
    connect(radio_key_mode,SIGNAL(toggled(bool)),key_edit,SLOT(setEnabled(bool)));
    connect(radio_key_mode,SIGNAL(toggled(bool)),build_password_btn,SLOT(setEnabled(bool)));
    connect(copy_btn,SIGNAL(clicked()),SLOT(copyPassword()));
}
Exemplo n.º 2
0
/*****************************************
 *Function: SetTimeDelay::SetTimeDelay
 *Brief: SetTimeDelay的构造函数
 *Param: QWidget *parent 父窗口指针
 *Retval:
 *Author: LiuBing
 *Data: 2013.11.25
*****************************************/
SetTimeDelay::SetTimeDelay(QWidget *parent)
    :QWidget(parent)
{
    client_password_label = new QLabel("客户编码:",this);
    client_password_label->setGeometry(LEFT_MARGIN,TOP_MARGIN,70,20);

    client_password_edit = new QLineEdit(this);
    client_password_edit->setGeometry(LEFT_MARGIN + 70,TOP_MARGIN,MAIN_LENGTH - 2 * LEFT_MARGIN - 70 - 50 - HORIZONTAL_STRECH,20);
    client_password_edit->setEchoMode(QLineEdit::Password);
    client_password_edit->setMaxLength(CLIENT_PASSWORD_LENGTH);
    QRegExp regx("[0-9A-Za-z]+$");
    QValidator *validator = new QRegExpValidator(regx);
    client_password_edit->setValidator(validator);

    client_password_hint_label = new QLabel("(妥善保管,严防泄漏、丢失)",this);
    client_password_hint_label->setGeometry(LEFT_MARGIN + 70,TOP_MARGIN + 20 + VERTICAL_STRECH,client_password_edit->width(),20);
    plain_code_checkbox = new QCheckBox("明码",this);
    plain_code_checkbox->setGeometry(MAIN_LENGTH - 50 - RIGHT_MARGIN,TOP_MARGIN,50,20);
    connect(plain_code_checkbox,SIGNAL(toggled(bool)),this,SLOT(setClientPasswordEcho(bool)));

    set_time_delay_group = new QGroupBox("延时、解除限时保护",this);
    set_time_delay_group->setGeometry(LEFT_MARGIN,TOP_MARGIN + 40 + 2 * VERTICAL_STRECH,MAIN_LENGTH - 2 * LEFT_MARGIN,
                                      MAIN_WIDTH - (TOP_MARGIN + 40 + 2 * VERTICAL_STRECH) - 10 - BASE_MARGIN);

    unlock_code_label = new QLabel("限时保护检测码:",set_time_delay_group);
    unlock_code_label->setGeometry(HORIZONTAL_STRECH,VERTICAL_STRECH * 2,90,20);
    unlock_code_edit = new QLineEdit(set_time_delay_group);
    unlock_code_edit->setGeometry(HORIZONTAL_STRECH + 90,VERTICAL_STRECH * 2,set_time_delay_group->width() - 90 - 2 * HORIZONTAL_STRECH,20);
    QRegExp number_regx("[0-9]+$");
    QValidator *number_validator = new QRegExpValidator(number_regx);
    unlock_code_edit->setValidator(number_validator);
    unlock_code_edit->setMaxLength(UNLOCK_CODE_LENGTH);

    time_delay_radio = new QRadioButton("延长限时",set_time_delay_group);
    time_delay_radio->setGeometry(HORIZONTAL_STRECH,VERTICAL_STRECH * 3 + 20,80,20);
    time_delay_radio->setChecked(true);

    relieve_limit_time_radio = new QRadioButton("永久解锁",set_time_delay_group);
    relieve_limit_time_radio->setGeometry(HORIZONTAL_STRECH,VERTICAL_STRECH * 4 + 40,80,20);
    time_delay_label = new QLabel("延长时间:",set_time_delay_group);
    time_delay_label->setGeometry(HORIZONTAL_STRECH + 90,VERTICAL_STRECH * 3 + 20,
                                  set_time_delay_group->width() - 90 - 2 * HORIZONTAL_STRECH - 150,20);
    time_delay_day_edit = new TimeEdit(DayType,set_time_delay_group);
    time_delay_day_edit->setGeometry(HORIZONTAL_STRECH + 90 + time_delay_label->width(),VERTICAL_STRECH * 3 + 20,50,20);
    time_delay_day_label = new QLabel("天",set_time_delay_group);
    time_delay_day_label->setGeometry(time_delay_day_edit->x() + time_delay_day_edit->width(),VERTICAL_STRECH * 3 + 20,25,20);
    time_delay_day_label->setAlignment(Qt::AlignCenter);
    time_delay_hour_edit = new TimeEdit(HourType,set_time_delay_group);
    time_delay_hour_edit->setGeometry(time_delay_day_label->x() + time_delay_day_label->width(),VERTICAL_STRECH * 3 + 20,50,20);
    time_delay_hour_label = new QLabel("小时",set_time_delay_group);
    time_delay_hour_label->setGeometry(time_delay_hour_edit->x() + time_delay_hour_edit->width(),VERTICAL_STRECH * 3 + 20,25,20);
    time_delay_hour_label->setAlignment(Qt::AlignCenter);
    build_password_button = new QPushButton("生成密码",set_time_delay_group);
    build_password_button->setGeometry(HORIZONTAL_STRECH,VERTICAL_STRECH * 5 + 60 - 2,80,24);
    build_password_edit = new QLineEdit(set_time_delay_group);
    build_password_edit->setGeometry(HORIZONTAL_STRECH + 90,VERTICAL_STRECH * 5 + 60,unlock_code_edit->width() - 75 + 20,20);
    build_password_edit->setEnabled(false);
    copy_password_button = new QPushButton("复制",set_time_delay_group);
    copy_password_button->setGeometry(time_delay_hour_edit->x() + HORIZONTAL_STRECH + 20,VERTICAL_STRECH * 5 + 60 - 2,60 - 20,24);
    version_label = new QLabel("版本:",set_time_delay_group);
    version_label->setGeometry(HORIZONTAL_STRECH,VERTICAL_STRECH * 6 + 80 - 2,40,24);
    version_box = new QComboBox(set_time_delay_group);
    version_box->setGeometry(HORIZONTAL_STRECH + 50,VERTICAL_STRECH * 6 + 80,60,20);
    version_box->addItem("V2.0");
    version_box->addItem("V2.1");

    connect(time_delay_radio,SIGNAL(toggled(bool)),time_delay_day_edit,SLOT(setEnabled(bool)));
    connect(time_delay_radio,SIGNAL(toggled(bool)),time_delay_hour_edit,SLOT(setEnabled(bool)));
    connect(build_password_button,SIGNAL(clicked()),this,SLOT(buildPasswordSlot()));
    connect(copy_password_button,SIGNAL(clicked()),this,SLOT(copyPassword()));
}
Exemplo n.º 3
0
TDEWalletEditor::TDEWalletEditor(const TQString& wallet, bool isPath, TQWidget *parent, const char *name)
: TDEMainWindow(parent, name), _walletName(wallet), _nonLocal(isPath) {
	_newWallet = false;
	_ww = new WalletWidget(this, "Wallet Widget");
	_copyPassAction = KStdAction::copy(TQT_TQOBJECT(this), TQT_SLOT(copyPassword()), actionCollection());

	TQVBoxLayout *box = new TQVBoxLayout(_ww->_entryListFrame);
	box->setSpacing( KDialog::spacingHint() );
	box->setMargin( KDialog::marginHint() );
	_entryList = new TDEWalletEntryList(_ww->_entryListFrame, "Wallet Entry List");
	box->addWidget(new TDEListViewSearchLineWidget(_entryList, _ww->_entryListFrame));
	box->addWidget(_entryList);

	_ww->_entryStack->setEnabled(true);

	box = new TQVBoxLayout(_ww->_entryStack->widget(2));
	_mapEditorShowHide = new TQCheckBox(i18n("&Show values"), _ww->_entryStack->widget(2));
	connect(_mapEditorShowHide, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(showHideMapEditorValue(bool)));
	_mapEditor = new KWMapEditor(_currentMap, _ww->_entryStack->widget(2));
	box->addWidget(_mapEditorShowHide);
	box->addWidget(_mapEditor);

	setCentralWidget(_ww);

	resize(600, 400);

	connect(_entryList, TQT_SIGNAL(selectionChanged(TQListViewItem*)),
		this, TQT_SLOT(entrySelectionChanged(TQListViewItem*)));
	connect(_entryList,
		TQT_SIGNAL(contextMenuRequested(TQListViewItem*,const TQPoint&,int)),
		this,
		TQT_SLOT(listContextMenuRequested(TQListViewItem*,const TQPoint&,int)));
	connect(_entryList,
		TQT_SIGNAL(itemRenamed(TQListViewItem*, int, const TQString&)),
		this,
		TQT_SLOT(listItemRenamed(TQListViewItem*, int, const TQString&)));

	connect(_ww->_passwordValue, TQT_SIGNAL(textChanged()),
		this, TQT_SLOT(entryEditted()));
	connect(_mapEditor, TQT_SIGNAL(dirty()),
		this, TQT_SLOT(entryEditted()));

	connect(_ww->_undoChanges, TQT_SIGNAL(clicked()),
		this, TQT_SLOT(restoreEntry()));
	connect(_ww->_saveChanges, TQT_SIGNAL(clicked()),
		this, TQT_SLOT(saveEntry()));

	connect(_ww->_showContents, TQT_SIGNAL(clicked()),
		this, TQT_SLOT(showPasswordContents()));
	connect(_ww->_hideContents, TQT_SIGNAL(clicked()),
		this, TQT_SLOT(hidePasswordContents()));

	_walletIsOpen = false;

	_w = TDEWallet::Wallet::openWallet(wallet, winId(), isPath ? TDEWallet::Wallet::Path : TDEWallet::Wallet::Asynchronous);
	if (_w) {
		connect(_w, TQT_SIGNAL(walletOpened(bool)), this, TQT_SLOT(walletOpened(bool)));
		connect(_w, TQT_SIGNAL(walletClosed()), this, TQT_SLOT(walletClosed()));
		connect(_w, TQT_SIGNAL(folderUpdated(const TQString&)), this, TQT_SLOT(updateEntries(const TQString&)));
		connect(_w, TQT_SIGNAL(folderListUpdated()), this, TQT_SLOT(updateFolderList()));
		updateFolderList();
	} else {