2 #include "mainwindow.h"
4 #include "locationbox.h"
5 #include "folderpanel.h"
6 #include "ui_folderpanel.h"
10 FolderPanel::FolderPanel(QWidget *parent) :
12 ui(new Ui::FolderPanel)
17 FolderPanel::~FolderPanel()
22 void FolderPanel::initialize(MainWindow *mainWnd)
24 qDebug() << "FolderPanel::initialize();";
27 connect(ui->folderView, SIGNAL(dataChanged()), this, SLOT(dataChange()));
28 connect(ui->folderView, SIGNAL(doubleClicked(QModelIndex)), mainWnd, SLOT(open(QModelIndex)));
29 connect(ui->folderView, SIGNAL(dropAccepted(QFileInfoList)), mainWnd, SLOT(dropAccept(QFileInfoList)));
30 connect(ui->folderView, SIGNAL(currentChanged(QFileInfo)), mainWnd, SLOT(currentChange(QFileInfo)));
31 connect(ui->folderView, SIGNAL(itemFound()), mainWnd, SLOT(itemFound()));
32 connect(ui->folderView, SIGNAL(itemNotFound()), mainWnd, SLOT(itemNotFound()));
33 connect(ui->folderView, SIGNAL(retrieveFinished()), mainWnd, SLOT(retrieveFinish()));
34 connect(ui->folderView, SIGNAL(requestContextMenu(QContextMenuEvent*)), mainWnd, SLOT(showContextMenu(QContextMenuEvent*)));
35 connect(ui->folderView, SIGNAL(retrieveStarted(QString)), mainWnd, SLOT(retrieveStart(QString)));
36 connect(ui->folderView, SIGNAL(retrieveStarted(QString)), ui->locationBox, SLOT(setText(QString)));
37 connect(ui->searchBox, SIGNAL(textEdited(QString)), mainWnd, SLOT(searchItem(QString)));
38 connect(ui->searchBox, SIGNAL(returnPressed()), mainWnd, SLOT(returnPressInSearchBox()));
41 ui->searchBox->setVisible(false);
44 ui->locationBox->initialize();
47 ui->folderView->initialize();
50 LocationBox *FolderPanel::locationBox() const
52 return ui->locationBox;
55 FolderView *FolderPanel::folderView() const
57 return ui->folderView;
60 SearchBox *FolderPanel::searchBox() const
65 QLabel *FolderPanel::filterLabel() const
67 return ui->filterLabel;
70 void FolderPanel::setNameFilters(const QString &filters)
72 QStringList list = filters.split(" ", QString::SkipEmptyParts);
76 ui->folderView->setNameFilters(list);
80 void FolderPanel::showNameFilters()
82 ui->filterLabel->setText(tr("フィルタ:") + ui->folderView->nameFilters().join(" "));
85 void FolderPanel::dataChange()
87 qDebug() << "FolderPanel::dataChange();";
89 FolderView *view = static_cast<FolderView*>(sender());
92 QFileInfoList list = view->checkedItems();
100 foreach (const QFileInfo &info, list) {
110 QString msg = QString::null;
111 if (numFolders > 0) {
112 msg += tr("%1個のフォルダ ").arg(numFolders);
115 msg += tr("%1個のファイル ").arg(numFiles);
118 if (!msg.isEmpty()) {
119 msg += tr("を選択 合計%1").arg(FilesizeToString(size));
122 ui->filterLabel->setText(msg);
126 void FolderPanel::focusInEvent(QFocusEvent *)
128 qDebug() << "FolderPanel::focusInEvent();";
130 ui->folderView->setFocus();