-
Notifications
You must be signed in to change notification settings - Fork 0
/
bmdialog.cpp
116 lines (84 loc) · 2.26 KB
/
bmdialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
ZHSC
bmdialog.cpp
v 0.0.1
2003/06/23
Copyright (C) 2003 Cavendish
http://www.qiliang.net/software/zhsc.html
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
*/
#include <qlayout.h>
#include "bmdialog.h"
#include "codec.h"
BMDialog::BMDialog( QWidget* parent, const char* name )
: QDialog( parent, name, TRUE )
{
bml.clear();
dbml.clear();
setCaption( Unicode( "ÖлªÊ«´Ê Qt°æ" ) );
QVBoxLayout *lmain = new QVBoxLayout( this, 10 );
table = new QTable( 0, 1, this );
table->setSelectionMode( QTable::NoSelection );
table->setLeftMargin( 0 );
table->setTopMargin( 0 );
table->setColumnWidth( 0, 300 );
lmain->addWidget( table );
QHBoxLayout *ldown = new QHBoxLayout( lmain, 3 );
pbDelete = new QPushButton( Unicode( "ɾ³ý(&D)" ), this );
pbCancel = new QPushButton( Unicode( "È¡Ïû(&C)" ), this );
ldown->addSpacing( 35 );
ldown->addWidget( pbDelete, 10 );
ldown->addSpacing( 30 );
ldown->addWidget( pbCancel, 10 );
ldown->addSpacing( 35 );
//lmain->addLayout( ldown );
connect( pbDelete, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( pbCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
s = size();
}
BMDialog::~BMDialog()
{
}
void BMDialog::setBML( BookmarkList b )
{
int i;
QCheckTableItem *c = NULL;
bml.clear();
cl.clear();
for ( i = 0; i < table->numRows(); ++i )
{
table->removeRow( i );
}
BookmarkList::Iterator it;
for ( it = b.begin(), i = 0; it != b.end(); ++it, ++i )
{
bml.append( (*it) );
table->insertRows( i );
c = new QCheckTableItem( table, "" );
cl.append( c );
table->setItem( i, 0, c );
table->setText( i, 0, (*it).content );
}
}
BookmarkList BMDialog::deletedBML() const
{
return dbml;
}
void BMDialog::accept()
{
dbml.clear();
QCheckTableItem *c;
BookmarkList::Iterator it;
for ( c = cl.first(), it = bml.begin(); c; c = cl.next(), ++it )
{
if ( c->isChecked() )
{
dbml.append( (*it) );
}
}
QDialog::accept();
}