1 #include "mainwindow.h"
2 #include "ui_mainwindow.h"
4 MainWindow::MainWindow(QWidget *parent) :
9 connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));
10 connect(ui->upButton, SIGNAL(clicked()), ui->fileListWidget, SLOT(changePathUp()));
11 connect(ui->locationLine, SIGNAL(returnPressed()), this, SLOT(locationLineEnterKeyHandler()));
12 connect(ui->fileListWidget, SIGNAL(pathChanged(QString)), ui->locationLine, SLOT(setText(QString)));
13 connect(ui->actionDelete, SIGNAL(triggered()), ui->fileListWidget, SLOT(actionDelete()));
14 connect(ui->actionMode, SIGNAL(toggled(bool)), ui->fileListWidget, SLOT(actionSwitchMode(bool)));
15 connect(ui->actionCopy, SIGNAL(triggered()), ui->fileListWidget, SLOT(actionCopy()));
16 connect(ui->actionCut, SIGNAL(triggered()), ui->fileListWidget, SLOT(actionCut()));
17 connect(ui->actionPaste, SIGNAL(triggered()), ui->fileListWidget, SLOT(actionPaste()));
18 connect(ui->actionShow_hidden, SIGNAL(toggled(bool)), ui->fileListWidget, SLOT(actionShowHidden(bool)));
19 connect(ui->actionRename, SIGNAL(triggered()), ui->fileListWidget, SLOT(actionRename()));
20 connect(ui->actionSend, SIGNAL(triggered()), ui->fileListWidget, SLOT(actionSendFiles()));
22 connect(ui->actionHelp, SIGNAL(triggered()), this, SLOT(showHelp()));
23 connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
25 ui->locationLine->setText(ui->fileListWidget->getPath());
28 ui->fileListWidget->addAction(ui->actionCopy);
29 ui->fileListWidget->addAction(ui->actionCut);
30 ui->fileListWidget->addAction(ui->actionPaste);
31 ui->fileListWidget->addAction(ui->actionDelete);
32 ui->fileListWidget->addAction(ui->actionRename);
33 ui->fileListWidget->addAction(ui->actionSend);
36 MainWindow::~MainWindow()
41 void MainWindow::locationLineEnterKeyHandler()
43 ui->fileListWidget->changePath(ui->locationLine->text());
45 void MainWindow::keyPressEvent(QKeyEvent *e)
47 if(e->key() == Qt::Key_Control || e->key() == Qt::Key_Shift)
48 ui->fileListWidget->setSelectMode(true);
50 QMainWindow::keyPressEvent(e);
52 void MainWindow::keyReleaseEvent(QKeyEvent *e)
54 if(e->key() == Qt::Key_Control || e->key() == Qt::Key_Shift)
55 ui->fileListWidget->setSelectMode(false);
57 QMainWindow::keyPressEvent(e);
60 void MainWindow::changeEvent(QEvent *e)
62 QMainWindow::changeEvent(e);
64 case QEvent::LanguageChange:
65 ui->retranslateUi(this);
72 void MainWindow::showHelp()
76 helpText.append("<h2>CuteExplorer "+tr("Help") +"</h2>");
77 helpText.append("<p>"+ tr("Cut, copy, delete, rename, paste and send files")+"<br/>");
78 helpText.append(tr("commands can be found from context menu (click and hold on maemo).")+"<br/>");
79 helpText.append(tr("To select files, use ctrl and shift")+"<br/>");
80 QMessageBox::about(this, tr("Help"),
83 void MainWindow::showAbout()
86 about.append("<h2>CuteExplorer</h2>");
87 about.append(tr("<p>Version %1<br/>").arg(QString(CUTE_VERSION)));
88 about.append(tr("Using Qt %1<br/>").arg(QString(QT_VERSION_STR)));
89 about.append(tr("Copyright") + " 2010 Tommi \"tomma\" Asp <tomma.asp@gmail.com><br/>");
91 about.append(tr("<p>CuteExplorer is file manager mainly for maemo5.<br/>"));
92 about.append(tr("This is still under development so please visit<br/>"));
93 about.append(tr("<a href=http://cuteexplorer.garage.maemo.org>http://cuteexplorer.garage.maemo.org</a><br/>"));
94 about.append(tr("to report bugs or leave feature requests. Thanks!</p>"));
96 QMessageBox::about(this, tr("About CuteExplorer"),