1 #include "foldermodel.h"
2 #include "historydialog.h"
3 #include "ui_historydialog.h"
5 HistoryDialog::HistoryDialog(QWidget *parent) :
7 ui(new Ui::HistoryDialog),
13 resize(parent->width() * 0.8, height());
16 HistoryDialog::~HistoryDialog()
21 void HistoryDialog::setModel(const FolderModel *left, const FolderModel *right, FolderModel *active)
25 m_activeModel = active;
28 ui->radioLeft->click();
31 ui->radioRight->click();
34 for (int n = left->history().size() - 1; n >= 0; --n) {
35 ui->listLeft->addItem(left->history().at(n));
37 for (int n = right->history().size() - 1; n >= 0; --n) {
38 ui->listRight->addItem(right->history().at(n));
42 void HistoryDialog::on_radioLeft_clicked()
44 ui->listRight->setVisible(false);
45 ui->listLeft->setVisible(true);
48 void HistoryDialog::on_radioRight_clicked()
50 ui->listLeft->setVisible(false);
51 ui->listRight->setVisible(true);
54 void HistoryDialog::accept()
57 const FolderModel *selected;
58 if (ui->radioLeft->isChecked()) {
59 selected = m_leftModel;
60 path = ui->listLeft->currentItem()->text();
63 selected = m_rightModel;
64 path = ui->listRight->currentItem()->text();
67 if (selected == m_activeModel) {
68 m_activeModel->setHistoryAt(path);
71 m_activeModel->setRootPath(path);