|
a/dirbrowser/dirbrowser.cpp |
|
b/dirbrowser/dirbrowser.cpp |
|
... |
|
... |
32 |
QKeySequence seq;
|
32 |
QKeySequence seq;
|
33 |
QShortcut *sc;
|
33 |
QShortcut *sc;
|
34 |
|
34 |
|
35 |
ui->setupUi(this);
|
35 |
ui->setupUi(this);
|
36 |
ui->searchFrame->hide();
|
36 |
ui->searchFrame->hide();
|
|
|
37 |
ui->tabs->setTabsClosable(true);
|
37 |
|
38 |
|
38 |
QToolButton *plusbut = new QToolButton(this);
|
39 |
QToolButton *plusbut = new QToolButton(this);
|
39 |
QString icon_path = Helper::getIconPath();
|
40 |
QString icon_path = Helper::getIconPath();
|
40 |
QIcon icon = QIcon(icon_path + "/addtab.png");
|
41 |
QIcon icon = QIcon(icon_path + "/addtab.png");
|
41 |
plusbut->setIcon(icon);
|
42 |
plusbut->setIcon(icon);
|
|
... |
|
... |
51 |
sc = new QShortcut(seq, this);
|
52 |
sc = new QShortcut(seq, this);
|
52 |
connect(sc, SIGNAL (activated()), this, SLOT(closeCurrentTab()));
|
53 |
connect(sc, SIGNAL (activated()), this, SLOT(closeCurrentTab()));
|
53 |
|
54 |
|
54 |
connect(ui->tabs, SIGNAL(currentChanged(int)),
|
55 |
connect(ui->tabs, SIGNAL(currentChanged(int)),
|
55 |
this, SLOT(onCurrentTabChanged(int)));
|
56 |
this, SLOT(onCurrentTabChanged(int)));
|
56 |
|
57 |
connect(ui->tabs, SIGNAL(tabCloseRequested(int)),
|
|
|
58 |
this, SLOT(closeTab(int)));
|
|
|
59 |
|
57 |
icon = QIcon(icon_path + "/cross.png");
|
60 |
icon = QIcon(icon_path + "/cross.png");
|
58 |
ui->closeSearchTB->setIcon(icon);
|
61 |
ui->closeSearchTB->setIcon(icon);
|
59 |
connect(ui->closeSearchTB, SIGNAL(clicked()),
|
62 |
connect(ui->closeSearchTB, SIGNAL(clicked()),
|
60 |
this, SLOT(closeSearchPanel()));
|
63 |
this, SLOT(closeSearchPanel()));
|
61 |
seq = QKeySequence("Ctrl+f");
|
64 |
seq = QKeySequence("Ctrl+f");
|
|
... |
|
... |
127 |
vl->addWidget(cdb);
|
130 |
vl->addWidget(cdb);
|
128 |
|
131 |
|
129 |
ui->tabs->addTab(tab, tr("Servers"));
|
132 |
ui->tabs->addTab(tab, tr("Servers"));
|
130 |
|
133 |
|
131 |
setupTabConnections(cdb);
|
134 |
setupTabConnections(cdb);
|
|
|
135 |
ui->tabs->setCurrentIndex(ui->tabs->count() -1);
|
132 |
}
|
136 |
}
|
133 |
|
137 |
|
134 |
void DirBrowser::closeCurrentTab()
|
138 |
void DirBrowser::closeCurrentTab()
|
|
|
139 |
{
|
|
|
140 |
closeTab(ui->tabs->currentIndex());
|
|
|
141 |
}
|
|
|
142 |
|
|
|
143 |
void DirBrowser::closeTab(int i)
|
135 |
{
|
144 |
{
|
136 |
if (m_insertactive || ui->tabs->count() <= 1)
|
145 |
if (m_insertactive || ui->tabs->count() <= 1)
|
137 |
return;
|
146 |
return;
|
138 |
QWidget *w = ui->tabs->currentWidget();
|
147 |
QWidget *w = ui->tabs->widget(i);
|
139 |
ui->tabs->removeTab(ui->tabs->currentIndex());
|
148 |
ui->tabs->removeTab(i);
|
140 |
delete w;
|
149 |
delete w;
|
141 |
}
|
150 |
}
|
142 |
|
151 |
|
143 |
// Adjust the search panel according the the server caps for the
|
152 |
// Adjust the search panel according the the server caps for the
|
144 |
// active tab
|
153 |
// active tab
|