1 #include "copymoveworker.h"
\r
2 #include "deleteworker.h"
\r
3 #include "mainwindow.h"
\r
4 #include "operationdialog.h"
\r
5 #include "overwritedialog.h"
\r
6 #include "renamemultidialog.h"
\r
7 #include "renamesingledialog.h"
\r
8 #include "renameworker.h"
\r
9 #include "ui_mainwindow.h"
\r
10 #include <QFileSystemModel>
\r
12 #include <QKeyEvent>
\r
13 #include <QDesktopServices>
\r
14 #include <QSettings>
\r
15 #include <QFileDialog>
\r
16 #include <QMessageBox>
\r
19 #include <QInputDialog>
\r
21 MainWindow::MainWindow(QWidget *parent) :
\r
22 QMainWindow(parent),
\r
23 ui(new Ui::MainWindow)
\r
28 bool checked = settings.value("Common/ShowHidden", false).toBool();
\r
29 ui->view_Hidden->setChecked(checked);
\r
31 // メニューのシグナル/スロットを設定する
\r
32 connect(ui->action_Command, SIGNAL(triggered()), this, SLOT(onActionCommand()));
\r
33 connect(ui->action_Exec, SIGNAL(triggered()), this, SLOT(onActionExec()));
\r
34 connect(ui->action_Open, SIGNAL(triggered()), this, SLOT(onActionOpen()));
\r
35 connect(ui->action_Quit, SIGNAL(triggered()), this, SLOT(onActionQuit()));
\r
36 connect(ui->action_Setting, SIGNAL(triggered()), this, SLOT(onActionSetting()));
\r
38 connect(ui->mark_All, SIGNAL(triggered()), this, SLOT(onMarkAll()));
\r
39 connect(ui->mark_AllFiles, SIGNAL(triggered()), this, SLOT(onMarkAllFiles()));
\r
40 connect(ui->mark_AllOff, SIGNAL(triggered()), this, SLOT(onMarkAllOff()));
\r
41 connect(ui->mark_Invert, SIGNAL(triggered()), this, SLOT(onMarkInvert()));
\r
42 connect(ui->mark_Toggle, SIGNAL(triggered()), this, SLOT(onMarkToggle()));
\r
44 connect(ui->move_Down, SIGNAL(triggered()), this, SLOT(onMoveCursorDown()));
\r
45 connect(ui->move_Up, SIGNAL(triggered()), this, SLOT(onMoveCursorUp()));
\r
46 connect(ui->move_Begin, SIGNAL(triggered()), this, SLOT(onMoveCursorBegin()));
\r
47 connect(ui->move_End, SIGNAL(triggered()), this, SLOT(onMoveCursorEnd()));
\r
48 connect(ui->move_Back, SIGNAL(triggered()), this, SLOT(onMoveBack()));
\r
49 connect(ui->move_Forward, SIGNAL(triggered()), this, SLOT(onMoveForward()));
\r
50 connect(ui->move_Home, SIGNAL(triggered()), this, SLOT(onMoveHome()));
\r
51 connect(ui->move_Jump, SIGNAL(triggered()), this, SLOT(onMoveJump()));
\r
52 connect(ui->move_Parent, SIGNAL(triggered()), this, SLOT(onMoveParent()));
\r
53 connect(ui->move_Root, SIGNAL(triggered()), this, SLOT(onMoveRoot()));
\r
55 connect(ui->view_FromOther, SIGNAL(triggered()), this, SLOT(onViewFromOther()));
\r
56 connect(ui->view_ToOther, SIGNAL(triggered()), this, SLOT(onViewToOther()));
\r
57 connect(ui->view_Hidden, SIGNAL(triggered()), this, SLOT(onViewHidden()));
\r
58 connect(ui->view_Swap, SIGNAL(triggered()), this, SLOT(onViewSwap()));
\r
60 connect(ui->cmd_Copy, SIGNAL(triggered()), this, SLOT(onCmdCopy()));
\r
61 connect(ui->cmd_Delete, SIGNAL(triggered()), this, SLOT(onCmdDelete()));
\r
62 connect(ui->cmd_Move, SIGNAL(triggered()), this, SLOT(onCmdMove()));
\r
63 connect(ui->cmd_NewFile, SIGNAL(triggered()), this, SLOT(onCmdNewFile()));
\r
64 connect(ui->cmd_NewFolder, SIGNAL(triggered()), this, SLOT(onCmdNewFolder()));
\r
65 connect(ui->cmd_Rename, SIGNAL(triggered()), this, SLOT(onCmdRename()));
\r
67 connect(ui->help_About, SIGNAL(triggered()), this, SLOT(onHelpAbout()));
\r
70 setWindowTitle(tr("げふぅ v0.00"));
\r
72 setWindowIcon(QIcon(":/images/Gefu.png"));
\r
79 path = settings.value("Left/dir", QDir::homePath()).toString();
\r
80 ui->folderPanel_L->setCurrentFolder(path);
\r
82 path = settings.value("Right/dir", QDir::homePath()).toString();
\r
83 ui->folderPanel_R->setCurrentFolder(path);
\r
86 MainWindow::~MainWindow()
\r
90 settings.setValue("Left/dir", ui->folderPanel_L->dir()->absolutePath());
\r
91 settings.setValue("Right/dir", ui->folderPanel_R->dir()->absolutePath());
\r
96 void MainWindow::setStatusText(const QString &str)
\r
98 ui->statusBar->showMessage(str);
\r
101 FolderPanel* MainWindow::activePanel()
\r
103 if (ui->folderPanel_L->fileTable()->hasFocus()) {
\r
104 return ui->folderPanel_L;
\r
106 if (ui->folderPanel_R->fileTable()->hasFocus()) {
\r
107 return ui->folderPanel_R;
\r
113 FolderPanel* MainWindow::inactivePanel()
\r
115 FolderPanel *fp = activePanel();
\r
116 if (fp == ui->folderPanel_L) {
\r
117 return ui->folderPanel_R;
\r
119 if (fp == ui->folderPanel_R) {
\r
120 return ui->folderPanel_L;
\r
127 /// \brief MainWindow::onActionCommand
\r
131 void MainWindow::onActionCommand()
\r
133 FolderPanel *fp = activePanel();
\r
138 QString command = "";
\r
139 for (int n = 0; n < fp->fileTable()->rowCount(); n++) {
\r
140 if (fp->fileTable()->item(n, 0)->checkState() == Qt::Checked) {
\r
141 QString path = fp->fileTable()->item(n, 1)->text();
\r
142 path = fp->dir()->absoluteFilePath(path);
\r
143 path = QDir::cleanPath(path);
\r
144 path = QDir::toNativeSeparators(path);
\r
146 QFileInfo info(path);
\r
147 if (info.isExecutable()) {
\r
148 command = "\"" + path + "\" " + command;
\r
151 command += " \"" + path + "\"";
\r
156 if (command.isEmpty()) {
\r
157 // int row = fp->fileTable()->currentIndex().row();
\r
158 int row = fp->fileTable()->currentRow();
\r
159 QString path = fp->fileTable()->item(row, 1)->text();
\r
160 path = fp->dir()->absoluteFilePath(path);
\r
161 path = QDir::cleanPath(path);
\r
162 path = QDir::toNativeSeparators(path);
\r
164 command = "\"" + path + "\"";
\r
167 QInputDialog dlg(this);
\r
168 dlg.setInputMode(QInputDialog::TextInput);
\r
169 dlg.setLabelText(tr("コマンドを入力:"));
\r
170 dlg.setWindowTitle(tr("コマンドを実行"));
\r
171 dlg.setTextValue(command);
\r
172 dlg.resize(500, 100);
\r
173 int ret = dlg.exec();
\r
174 command = dlg.textValue();
\r
175 if (ret == QDialog::Accepted && !command.isEmpty()) {
\r
176 QProcess process(this);
\r
177 process.setWorkingDirectory(fp->dir()->absolutePath());
\r
178 if (!process.startDetached(command)) {
\r
179 QMessageBox::critical(
\r
182 tr("コマンドの実行に失敗しました。<br/>") + command);
\r
188 /// \brief MainWindow::onActionExec
\r
190 /// アプリケーションで開きます(Shift + Enter)
\r
192 void MainWindow::onActionExec()
\r
194 FolderPanel *fp = activePanel();
\r
200 for (int n = 0; n < fp->fileTable()->rowCount(); n++) {
\r
201 if (fp->fileTable()->item(n, 0)->checkState() == Qt::Checked) {
\r
202 QString path = fp->fileTable()->item(n, 1)->text();
\r
203 path = fp->dir()->absoluteFilePath(path);
\r
204 path = QDir::toNativeSeparators(path);
\r
205 QDesktopServices::openUrl(QUrl("file:///" + path));
\r
211 // int row = fp->fileTable()->currentIndex().row();
\r
212 int row = fp->fileTable()->currentRow();
\r
213 QString path = fp->fileTable()->item(row, 1)->text();
\r
214 path = fp->dir()->absoluteFilePath(path);
\r
215 path = QDir::toNativeSeparators(path);
\r
216 QDesktopServices::openUrl(QUrl("file:///" + path));
\r
221 /// \brief MainWindow::onActionOpen
\r
223 /// フォルダを開きます(Enter)
\r
225 void MainWindow::onActionOpen()
\r
227 FolderPanel *fp = activePanel();
\r
232 // int row = fp->fileTable()->currentIndex().row();
\r
233 int row = fp->fileTable()->currentRow();
\r
234 QString path = fp->fileTable()->item(row, 1)->text();
\r
235 path = fp->dir()->absoluteFilePath(path);
\r
236 QFileInfo info(path);
\r
238 if (info.isDir()) {
\r
239 fp->setCurrentFolder(path);
\r
244 /// \brief MainWindow::onActionQuit
\r
246 /// アプリケーションを終了します(Q)
\r
248 void MainWindow::onActionQuit()
\r
254 /// \brief MainWindow::onActionSetting
\r
256 /// 環境設定ダイアログを表示します(Z)
\r
258 void MainWindow::onActionSetting()
\r
260 QMessageBox::information(this, tr("情報"), tr("環境設定機能は未実装です。"));
\r
264 /// \brief MainWindow::on_mark_All_triggered
\r
266 /// すべてマークします(Shift + A)
\r
268 void MainWindow::onMarkAll()
\r
270 FolderPanel *fp = activePanel();
\r
276 if (fp->fileTable()->item(row, 1)->text() == "..") {
\r
280 for (; row < fp->fileTable()->rowCount(); row++) {
\r
281 fp->fileTable()->item(row, 0)->setCheckState(Qt::Checked);
\r
286 /// \brief MainWindow::onMarkAllFiles
\r
288 /// すべての「ファイル」をマークします(A)
\r
290 void MainWindow::onMarkAllFiles()
\r
292 FolderPanel *fp = activePanel();
\r
298 if (fp->fileTable()->item(row, 1)->text() == "..") {
\r
302 for (; row < fp->fileTable()->rowCount(); row++) {
\r
303 QString path = fp->fileTable()->item(row, 1)->text();
\r
304 path = fp->dir()->absoluteFilePath(path);
\r
306 QFileInfo info(path);
\r
307 if (info.isDir()) {
\r
308 fp->fileTable()->item(row, 0)->setCheckState(Qt::Unchecked);
\r
311 fp->fileTable()->item(row, 0)->setCheckState(Qt::Checked);
\r
317 /// \brief MainWindow::onMarkAllOff
\r
319 /// すべてのマークを解除します(U)
\r
321 void MainWindow::onMarkAllOff()
\r
323 FolderPanel *fp = activePanel();
\r
329 if (fp->fileTable()->item(row, 1)->text() == "..") {
\r
333 for (; row < fp->fileTable()->rowCount(); row++) {
\r
334 fp->fileTable()->item(row, 0)->setCheckState(Qt::Unchecked);
\r
339 /// \brief MainWindow::onMarkInvert
\r
343 void MainWindow::onMarkInvert()
\r
345 FolderPanel *fp = activePanel();
\r
351 if (fp->fileTable()->item(row, 1)->text() == "..") {
\r
355 for (; row < fp->fileTable()->rowCount(); row++) {
\r
356 QTableWidgetItem *item = fp->fileTable()->item(row, 0);
\r
357 if (item->checkState() == Qt::Checked) {
\r
358 item->setCheckState(Qt::Unchecked);
\r
361 item->setCheckState(Qt::Checked);
\r
367 /// \brief MainWindow::onMarkToggle
\r
369 /// マークを設定または解除します(Space)
\r
371 void MainWindow::onMarkToggle()
\r
373 FolderPanel *fp = activePanel();
\r
378 // int row = fp->fileTable()->currentIndex().row();
\r
379 int row = fp->fileTable()->currentRow();
\r
380 QTableWidgetItem *item = fp->fileTable()->item(row, 0);
\r
381 if (fp->fileTable()->item(row, 1)->text() != "..") {
\r
382 if (item->checkState() == Qt::Checked) {
\r
383 item->setCheckState(Qt::Unchecked);
\r
386 item->setCheckState(Qt::Checked);
\r
389 // 最終行でなければ、次のアイテムに移動する
\r
390 if (row < fp->fileTable()->rowCount() - 1) {
\r
391 QModelIndex nextIndex = fp->fileTable()->model()->index(row + 1, 1);
\r
392 fp->fileTable()->setCurrentIndex(nextIndex);
\r
397 /// \brief MainWindow::onMoveCursorDown
\r
399 /// カーソルを下に移動します(J)
\r
401 void MainWindow::onMoveCursorDown()
\r
403 FolderPanel *fp = activePanel();
\r
408 // int row = fp->fileTable()->currentIndex().row();
\r
409 int row = fp->fileTable()->currentRow();
\r
410 if (row < fp->fileTable()->rowCount() - 1) {
\r
411 QModelIndex nextIndex = fp->fileTable()->model()->index(row + 1, 1);
\r
412 fp->fileTable()->setCurrentIndex(nextIndex);
\r
417 /// \brief MainWindow::onMoveCursorUp
\r
419 /// カーソルを上に移動します(K)
\r
421 void MainWindow::onMoveCursorUp()
\r
423 FolderPanel *fp = activePanel();
\r
428 // int row = fp->fileTable()->currentIndex().row();
\r
429 int row = fp->fileTable()->currentRow();
\r
431 QModelIndex nextIndex = fp->fileTable()->model()->index(row - 1, 1);
\r
432 fp->fileTable()->setCurrentIndex(nextIndex);
\r
437 /// \brief MainWindow::onMoveCursorBegin
\r
439 /// カーソルを先頭に移動します(G)
\r
441 void MainWindow::onMoveCursorBegin()
\r
443 FolderPanel *fp = activePanel();
\r
448 QModelIndex nextIndex = fp->fileTable()->model()->index(0, 1);
\r
449 fp->fileTable()->setCurrentIndex(nextIndex);
\r
453 /// \brief MainWindow::onMoveCursorEnd
\r
455 /// カーソルを末尾に移動します(Shift + G)
\r
456 void MainWindow::onMoveCursorEnd()
\r
458 FolderPanel *fp = activePanel();
\r
463 int row = fp->fileTable()->rowCount() - 1;
\r
464 QModelIndex nextIndex = fp->fileTable()->model()->index(row, 1);
\r
465 fp->fileTable()->setCurrentIndex(nextIndex);
\r
469 /// \brief MainWindow::onMoveBack
\r
471 /// 前の履歴に戻ります(Alt + ←)
\r
473 void MainWindow::onMoveBack()
\r
475 QMessageBox::information(this, tr("情報"), tr("履歴機能は未実装です。"));
\r
479 /// \brief MainWindow::onMoveForward
\r
481 /// 次の履歴に進みます(Alt + →)
\r
483 void MainWindow::onMoveForward()
\r
485 QMessageBox::information(this, tr("情報"), tr("履歴機能は未実装です。"));
\r
490 /// \brief MainWindow::onMoveHome
\r
492 /// ホームフォルダに移動します(H)
\r
494 void MainWindow::onMoveHome()
\r
496 FolderPanel *fp = activePanel();
\r
501 fp->setCurrentFolder(QDir::homePath());
\r
505 /// \brief MainWindow::onMoveJump
\r
507 /// フォルダを選択して移動します(Shift + J)
\r
508 void MainWindow::onMoveJump()
\r
510 FolderPanel *fp = activePanel();
\r
515 QString path = QFileDialog::getExistingDirectory(
\r
518 fp->dir()->absolutePath());
\r
519 if (!path.isEmpty()) {
\r
520 fp->setCurrentFolder(path);
\r
525 /// \brief MainWindow::onMoveOther
\r
527 /// キーボードフォーカスを他方のパネルに移動します(TAB)
\r
529 void MainWindow::onMoveOther()
\r
531 FolderPanel *fp = this->inactivePanel();
\r
533 fp->fileTable()->setFocus();
\r
538 /// \brief MainWindow::onMoveParent
\r
540 /// 親フォルダに移動します(Backspace)
\r
542 void MainWindow::onMoveParent()
\r
544 FolderPanel *fp = activePanel();
\r
549 if (!fp->dir()->isRoot()) {
\r
550 QString path = fp->dir()->absoluteFilePath("..");
\r
551 fp->setCurrentFolder(path);
\r
556 /// \brief MainWindow::onMoveRoot
\r
558 /// ルートフォルダに移動します()
\r
559 void MainWindow::onMoveRoot()
\r
561 FolderPanel *fp = activePanel();
\r
566 if (!fp->dir()->isRoot()) {
\r
567 fp->setCurrentFolder(QDir::rootPath());
\r
572 /// \brief MainWindow::onViewFromOther
\r
574 /// 隣のパネルと同じフォルダを表示します(O)
\r
576 void MainWindow::onViewFromOther()
\r
578 FolderPanel *fp1 = activePanel();
\r
579 FolderPanel *fp2 = inactivePanel();
\r
580 if (fp1 == NULL || fp2 == NULL) {
\r
584 fp1->setCurrentFolder(fp2->dir()->absolutePath());
\r
588 /// \brief MainWindow::onViewToOther
\r
590 /// 隣のパネルに同じフォルダを表示します(Shift + O)
\r
592 void MainWindow::onViewToOther()
\r
594 FolderPanel *fp1 = activePanel();
\r
595 FolderPanel *fp2 = inactivePanel();
\r
596 if (fp1 == NULL || fp2 == NULL) {
\r
600 fp2->setCurrentFolder(fp1->dir()->absolutePath());
\r
604 /// \brief MainWindow::onViewHidden
\r
606 /// 隠しファイルの表示/非表示を切り替えます(Shift + H)
\r
607 void MainWindow::onViewHidden()
\r
609 QSettings settings;
\r
610 bool checked = !settings.value("Common/ShowHidden", false).toBool();
\r
611 settings.setValue("Common/ShowHidden", checked);
\r
614 ui->folderPanel_L->dir()->setFilter(ui->folderPanel_L->dir()->filter() | QDir::Hidden);
\r
615 ui->folderPanel_R->dir()->setFilter(ui->folderPanel_R->dir()->filter() | QDir::Hidden);
\r
618 ui->folderPanel_L->dir()->setFilter(ui->folderPanel_L->dir()->filter() ^ QDir::Hidden);
\r
619 ui->folderPanel_R->dir()->setFilter(ui->folderPanel_R->dir()->filter() ^ QDir::Hidden);
\r
622 ui->folderPanel_L->setCurrentFolder(ui->folderPanel_L->dir()->absolutePath());
\r
623 ui->folderPanel_R->setCurrentFolder(ui->folderPanel_R->dir()->absolutePath());
\r
627 /// \brief MainWindow::onViewSwap
\r
629 /// パネルの表示内容を交換します(W)
\r
631 void MainWindow::onViewSwap()
\r
633 FolderPanel *fp1 = activePanel();
\r
634 FolderPanel *fp2 = inactivePanel();
\r
635 if (fp1 == NULL || fp2 == NULL) {
\r
639 QString path1 = fp1->dir()->absolutePath();
\r
640 QString path2 = fp2->dir()->absolutePath();
\r
642 fp1->setCurrentFolder(path2);
\r
643 fp2->setCurrentFolder(path1);
\r
646 void MainWindow::onCmdMove()
\r
648 FolderPanel *fp = activePanel();
\r
653 QStringList list = selectedItems(fp);
\r
654 if (list.isEmpty()) {
\r
658 CopyMoveWorker *worker = new CopyMoveWorker();
\r
659 connect(worker, SIGNAL(askOverWrite(bool*,int*,int*,QString*,QString,QString)),
\r
660 this, SLOT(onAskOverWrite(bool*,int*,int*,QString*,QString,QString)));
\r
661 worker->setCopyList(&list);
\r
662 worker->setTargetDir(inactivePanel()->dir()->absolutePath());
\r
663 worker->setMoveMode(true);
\r
665 OperationDialog opDlg(this);
\r
666 opDlg.setWindowTitle(tr("移動"));
\r
667 opDlg.setWorker(worker);
\r
669 ui->folderPanel_L->UninstallWatcher();
\r
670 ui->folderPanel_R->UninstallWatcher();
\r
672 ui->folderPanel_L->setCurrentFolder(ui->folderPanel_L->dir()->absolutePath());
\r
673 ui->folderPanel_R->setCurrentFolder(ui->folderPanel_R->dir()->absolutePath());
\r
677 void MainWindow::onCmdCopy()
\r
679 FolderPanel *fp = activePanel();
\r
684 QStringList list = selectedItems(fp);
\r
685 if (list.isEmpty()) {
\r
689 CopyMoveWorker *worker = new CopyMoveWorker();
\r
690 connect(worker, SIGNAL(askOverWrite(bool*,int*,int*,QString*,QString,QString)),
\r
691 this, SLOT(onAskOverWrite(bool*,int*,int*,QString*,QString,QString)));
\r
692 worker->setCopyList(&list);
\r
693 worker->setTargetDir(inactivePanel()->dir()->absolutePath());
\r
694 worker->setMoveMode(false);
\r
696 OperationDialog opDlg(this);
\r
697 opDlg.setWindowTitle(tr("コピー"));
\r
698 opDlg.setWorker(worker);
\r
700 ui->folderPanel_L->UninstallWatcher();
\r
701 ui->folderPanel_R->UninstallWatcher();
\r
703 ui->folderPanel_L->setCurrentFolder(ui->folderPanel_L->dir()->absolutePath());
\r
704 ui->folderPanel_R->setCurrentFolder(ui->folderPanel_R->dir()->absolutePath());
\r
708 void MainWindow::onAskOverWrite(bool *bOk, int *prevCopyMethod, int *copyMethod,
\r
709 QString *alias, const QString srcPath,
\r
710 const QString tgtPath)
\r
712 OverWriteDialog dlg;
\r
713 dlg.setCopyMethod(*prevCopyMethod);
\r
714 dlg.setSameMethodChecked(*copyMethod != OverWriteDialog::Undefined);
\r
715 dlg.setFileInfo(srcPath, tgtPath);
\r
716 if (dlg.exec() == QDialog::Rejected) {
\r
720 *prevCopyMethod = dlg.copyMethod();
\r
721 if (dlg.isSameMethodChecked()) {
\r
722 *copyMethod = *prevCopyMethod;
\r
724 *alias = dlg.alias();
\r
727 CopyMoveWorker *worker = static_cast<CopyMoveWorker*>(sender());
\r
728 worker->endAsking();
\r
732 /// \brief MainWindow::onCmdDelete
\r
736 void MainWindow::onCmdDelete()
\r
738 FolderPanel *fp = activePanel();
\r
743 QStringList list = selectedItems(fp);
\r
744 if (list.isEmpty()) {
\r
749 if (list.size() == 1) {
\r
750 msg = QFileInfo(list.at(0)).fileName();
\r
753 msg = tr("%1個のアイテム").arg(list.size());
\r
755 int ret = QMessageBox::question(
\r
758 msg + tr("を削除します<br/>よろしいですか?"));
\r
759 if (ret == QMessageBox::Yes) {
\r
760 DeleteWorker *worker = new DeleteWorker();
\r
761 worker->setDeleteList(&list);
\r
763 OperationDialog opDlg(this);
\r
764 opDlg.setWindowTitle(tr("削除"));
\r
765 opDlg.setWorker(worker);
\r
767 ui->folderPanel_L->UninstallWatcher();
\r
768 ui->folderPanel_R->UninstallWatcher();
\r
770 ui->folderPanel_L->setCurrentFolder(ui->folderPanel_L->dir()->absolutePath());
\r
771 ui->folderPanel_R->setCurrentFolder(ui->folderPanel_R->dir()->absolutePath());
\r
776 /// \brief MainWindow::onCmdNewFile
\r
780 void MainWindow::onCmdNewFile()
\r
782 FolderPanel *fp = activePanel();
\r
788 QString name = QInputDialog::getText(
\r
795 if (bOk && !name.isEmpty()) {
\r
796 QFile file(fp->dir()->absoluteFilePath(name));
\r
797 if (!file.open(QIODevice::WriteOnly)) {
\r
798 QMessageBox::critical(this,
\r
800 tr("ファイルの作成に失敗しました。"));
\r
809 /// \brief MainWindow::onCmdNewFolder
\r
813 void MainWindow::onCmdNewFolder()
\r
815 FolderPanel *fp = activePanel();
\r
821 QString name = QInputDialog::getText(
\r
828 if (bOk && !name.isEmpty()) {
\r
829 if (!fp->dir()->mkpath(name)) {
\r
830 QMessageBox::critical(this,
\r
832 tr("フォルダの作成に失敗しました。"));
\r
838 /// \brief MainWindow::onCmdRename
\r
842 void MainWindow::onCmdRename()
\r
844 FolderPanel *fp = activePanel();
\r
849 QStringList list = selectedItems(fp);
\r
850 if (list.isEmpty()) {
\r
854 IRenameDialog *dlg;
\r
855 if (list.size() == 1) {
\r
856 dlg = new RenameSingleDialog(this);
\r
859 dlg = new RenameMultiDialog(this);
\r
861 dlg->setWorkingDirectory(fp->dir()->absolutePath());
\r
862 dlg->setNames(list);
\r
863 int dlgResult = dlg->exec();
\r
864 if (dlgResult == QDialog::Accepted && !dlg->renameMap().isEmpty()) {
\r
865 RenameWorker *worker = new RenameWorker();
\r
866 worker->setRenameMap(&dlg->renameMap());
\r
868 OperationDialog opDlg(this);
\r
869 opDlg.setWindowTitle(tr("名前を変更"));
\r
870 opDlg.setWorker(worker);
\r
872 ui->folderPanel_L->UninstallWatcher();
\r
873 ui->folderPanel_R->UninstallWatcher();
\r
875 ui->folderPanel_L->setCurrentFolder(ui->folderPanel_L->dir()->absolutePath());
\r
876 ui->folderPanel_R->setCurrentFolder(ui->folderPanel_R->dir()->absolutePath());
\r
881 /// \brief MainWindow::onHelpAbout
\r
883 /// アプリケーションの概要を表示します(?)
\r
885 void MainWindow::onHelpAbout()
\r
887 QMessageBox::about(
\r
890 tr("<h3>Gefu Ver0.00</h3>"
\r
891 "<center>Gefu is Experimental File Utility.<br/>"
\r
892 "(げふぅは実験的なファイルユーティリティです)</center>"
\r
893 "<p>Copyright 2014 @miyabi_satoh All rights reserved.</p>"));
\r
896 QStringList MainWindow::selectedItems(FolderPanel *fp)
\r
899 for (int n = 0; n < fp->fileTable()->rowCount(); n++) {
\r
900 if (fp->fileTable()->item(n, 0)->checkState() == Qt::Checked) {
\r
901 list << fp->dir()->absoluteFilePath(fp->fileTable()->item(n, 1)->text());
\r
905 if (list.isEmpty()) {
\r
906 int row = fp->fileTable()->currentRow();
\r
907 QString name = fp->fileTable()->item(row, 1)->text();
\r
908 if (name != "..") {
\r
909 list << fp->dir()->absoluteFilePath(name);
\r