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());
27 ui->actionExit->setShortcut(QKeySequence::Quit);
29 ui->actionCopy->setShortcut(QKeySequence::Copy);
30 ui->actionCut->setShortcut(QKeySequence::Cut);
31 ui->actionPaste->setShortcut(QKeySequence::Paste);
32 ui->actionDelete->setShortcut(QKeySequence("Ctrl+D"));
33 ui->actionRename->setShortcut(QKeySequence("Ctrl+R"));
34 ui->actionSend->setShortcut(QKeySequence::Save);
35 ui->fileListWidget->addAction(ui->actionCopy);
36 ui->fileListWidget->addAction(ui->actionCut);
37 ui->fileListWidget->addAction(ui->actionPaste);
38 ui->fileListWidget->addAction(ui->actionDelete);
39 ui->fileListWidget->addAction(ui->actionRename);
40 ui->fileListWidget->addAction(ui->actionSend);
43 MainWindow::~MainWindow()
48 void MainWindow::locationLineEnterKeyHandler()
50 ui->fileListWidget->changePath(ui->locationLine->text());
52 void MainWindow::keyPressEvent(QKeyEvent *e)
54 if(e->key() == Qt::Key_Control || e->key() == Qt::Key_Shift)
55 ui->fileListWidget->setSelectMode(true);
57 QMainWindow::keyPressEvent(e);
59 void MainWindow::keyReleaseEvent(QKeyEvent *e)
61 if(e->key() == Qt::Key_Control || e->key() == Qt::Key_Shift)
62 ui->fileListWidget->setSelectMode(false);
64 QMainWindow::keyPressEvent(e);
67 void MainWindow::changeEvent(QEvent *e)
69 QMainWindow::changeEvent(e);
71 case QEvent::LanguageChange:
72 ui->retranslateUi(this);
79 void MainWindow::showHelp()
83 helpText.append("<h2>CuteExplorer "+tr("Help") +"</h2>");
84 helpText.append("<p>"+ tr("Cut, copy, delete, rename, paste and send files")+"<br/>");
85 helpText.append(tr("commands can be found from context menu (click and hold on maemo).")+"<br/>");
86 helpText.append(tr("To select files, use ctrl and shift")+"<br/>");
87 QMessageBox::about(this, tr("Help"),
90 void MainWindow::showAbout()
93 about.append("<h2>CuteExplorer</h2>");
94 about.append(tr("<p>Version %1<br/>").arg(QString(CUTE_VERSION)));
95 about.append(tr("Using Qt %1<br/>").arg(QString(QT_VERSION_STR)));
96 about.append(tr("Copyright") + " 2010 Tommi \"tomma\" Asp <tomma.asp@gmail.com><br/>");
98 about.append(tr("<p>CuteExplorer is file manager mainly for maemo5.<br/>"));
99 about.append(tr("This is still under development so please visit<br/>"));
100 about.append(tr("<a href=http://cuteexplorer.garage.maemo.org>http://cuteexplorer.garage.maemo.org</a><br/>"));
101 about.append(tr("to report bugs or leave feature requests. Thanks!</p>"));
103 QMessageBox::about(this, tr("About CuteExplorer"),