Initial commit
authorTommi Asp <tomma.asp@gmail.com>
Mon, 22 Mar 2010 13:36:30 +0000 (15:36 +0200)
committerTommi Asp <tomma.asp@gmail.com>
Mon, 22 Mar 2010 13:36:30 +0000 (15:36 +0200)
14 files changed:
cuteexplorer.desktop [new file with mode: 0644]
cuteexplorer_icon.svg [new file with mode: 0644]
cuteexplorer_icon48.png [new file with mode: 0644]
cuteexplorer_icon64.png [new file with mode: 0644]
cuteexplorertranslation_fi_FI.qm [new file with mode: 0644]
cuteexplorertranslation_fi_FI.ts [new file with mode: 0644]
filelistwidget.cpp [new file with mode: 0644]
filelistwidget.h [new file with mode: 0644]
i18n.qrc [new file with mode: 0644]
main.cpp [new file with mode: 0644]
mainwindow.cpp [new file with mode: 0644]
mainwindow.h [new file with mode: 0644]
mainwindow.ui [new file with mode: 0644]
src.pro [new file with mode: 0644]

diff --git a/cuteexplorer.desktop b/cuteexplorer.desktop
new file mode 100644 (file)
index 0000000..51aa75b
--- /dev/null
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Type=Application
+Name=CuteExplorer
+Comment=Explore your maemo
+Exec=/usr/local/bin/cuteexplorer
+Icon=cuteexplorer_icon64
diff --git a/cuteexplorer_icon.svg b/cuteexplorer_icon.svg
new file mode 100644 (file)
index 0000000..9286d9e
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" width="64" height="64" id="svg2383">
+  <defs id="defs2385">
+    <linearGradient id="linearGradient3203">
+      <stop id="stop3205" style="stop-color: rgb(47, 47, 47); stop-opacity: 1;" offset="0"/>
+      <stop id="stop3207" style="stop-color: rgb(25, 25, 25); stop-opacity: 1;" offset="1"/>
+    </linearGradient>
+    <linearGradient id="linearGradient3171">
+      <stop id="stop3173" style="stop-color: rgb(81, 81, 81); stop-opacity: 1;" offset="0"/>
+      <stop id="stop3175" style="stop-color: rgb(22, 22, 22); stop-opacity: 1;" offset="1"/>
+    </linearGradient>
+    <radialGradient cx="31.643028" cy="8.0269022" r="18.113558" fx="31.643028" fy="8.0269022" id="radialGradient3177" xlink:href="#linearGradient3171" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-2.86067e-07, 1.26887, -1.16834, 0, 40.9694, -26.5322)"/>
+    <linearGradient x1="9.3691645" y1="13.265088" x2="9.3691645" y2="36.072021" id="linearGradient3209" xlink:href="#linearGradient3203" gradientUnits="userSpaceOnUse"/>
+  </defs>
+  <g id="layer1">
+    <rect width="52.38591" height="30.383835" rx="3.047076" ry="3.047076" x="5.807045" y="21.418575" id="rect2395" style="opacity: 1; fill: rgb(51, 51, 51); fill-opacity: 1; stroke: rgb(0, 0, 0); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;"/>
+    <rect width="56.568539" height="28.833637" rx="2.3849602" ry="2.3849602" x="3.7157307" y="11.497321" id="rect2393" style="opacity: 1; fill: url(&quot;#linearGradient3209&quot;) rgb(0, 0, 0); fill-opacity: 1; stroke: rgb(0, 0, 0); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;"/>
+    <rect width="46.342133" height="6.2007828" rx="2.1137414" ry="2.1137414" x="8.8289337" y="42.985096" id="rect2397" style="opacity: 1; fill: rgb(22, 22, 22); fill-opacity: 1; stroke: none; stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;"/>
+    <rect width="41.477116" height="24.803131" rx="0" ry="0" x="11.261442" y="13.357556" id="rect3169" style="opacity: 1; fill: url(&quot;#radialGradient3177&quot;) rgb(0, 0, 0); fill-opacity: 1; stroke: rgb(128, 128, 128); stroke-width: 0.5; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;"/>
+    <g transform="translate(0.125, 1.625)" id="g3189">
+      <path d="M 17.6875,21.25 L 45.8125,21.25" id="path3181" style="fill: none; fill-rule: evenodd; stroke: rgb(230, 230, 230); stroke-width: 1px; stroke-linecap: butt; stroke-linejoin: miter; stroke-opacity: 1;"/>
+      <path d="M 17.6875,24.208333 L 45.8125,24.208333" id="path3183" style="fill: none; fill-rule: evenodd; stroke: rgb(230, 230, 230); stroke-width: 1px; stroke-linecap: butt; stroke-linejoin: miter; stroke-opacity: 1;"/>
+      <path d="M 17.6875,27.166667 L 45.8125,27.166667" id="path3185" style="fill: none; fill-rule: evenodd; stroke: rgb(230, 230, 230); stroke-width: 1px; stroke-linecap: butt; stroke-linejoin: miter; stroke-opacity: 1;"/>
+      <path d="M 17.6875,30.125 L 38.570012,30.125" id="path3187" style="fill: none; fill-rule: evenodd; stroke: rgb(230, 230, 230); stroke-width: 1px; stroke-linecap: butt; stroke-linejoin: miter; stroke-opacity: 1;"/>
+    </g>
+    <rect width="40.9375" height="3.8125" rx="0" ry="0" x="11.53125" y="13.625" id="rect3211" style="opacity: 1; fill: rgb(102, 102, 102); fill-opacity: 1; stroke: none; stroke-width: 0.5; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;"/>
+    <path d="M 17.5,15.3125 A 0.6875,0.6875 0 1 1 16.125,15.3125 A 0.6875,0.6875 0 1 1 17.5,15.3125 z" transform="matrix(1.72727, 0, 0, 1.72727, -15.6023, -11.1989)" id="path3179" style="opacity: 1; fill: rgb(85, 153, 255); fill-opacity: 1; stroke: none; stroke-width: 0.5; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;"/>
+    <path d="M 17.5,15.3125 A 0.6875,0.6875 0 1 1 16.125,15.3125 A 0.6875,0.6875 0 1 1 17.5,15.3125 z" transform="matrix(1.72727, 0, 0, 1.72727, -1.66477, -11.1989)" id="path3218" style="opacity: 1; fill: rgb(128, 255, 128); fill-opacity: 1; stroke: none; stroke-width: 0.5; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 4; stroke-dasharray: none; stroke-dashoffset: 0pt; stroke-opacity: 1;"/>
+    <path d="M 18,15.375 L 24,15.375" id="path3220" style="fill: none; fill-rule: evenodd; stroke: rgb(230, 230, 230); stroke-width: 1px; stroke-linecap: butt; stroke-linejoin: miter; stroke-opacity: 1;"/>
+  </g>
+</svg>
\ No newline at end of file
diff --git a/cuteexplorer_icon48.png b/cuteexplorer_icon48.png
new file mode 100644 (file)
index 0000000..bd653e7
Binary files /dev/null and b/cuteexplorer_icon48.png differ
diff --git a/cuteexplorer_icon64.png b/cuteexplorer_icon64.png
new file mode 100644 (file)
index 0000000..6ec2c59
Binary files /dev/null and b/cuteexplorer_icon64.png differ
diff --git a/cuteexplorertranslation_fi_FI.qm b/cuteexplorertranslation_fi_FI.qm
new file mode 100644 (file)
index 0000000..41afdda
Binary files /dev/null and b/cuteexplorertranslation_fi_FI.qm differ
diff --git a/cuteexplorertranslation_fi_FI.ts b/cuteexplorertranslation_fi_FI.ts
new file mode 100644 (file)
index 0000000..5631905
--- /dev/null
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fi_FI">
+<context>
+    <name>FileListWidget</name>
+    <message>
+        <location filename="filelistwidget.cpp" line="71"/>
+        <source>Rename</source>
+        <translation>Uudelleen nimeä</translation>
+    </message>
+    <message>
+        <location filename="filelistwidget.cpp" line="71"/>
+        <source>New filename: </source>
+        <translation>Uusi tiedoston nimi:</translation>
+    </message>
+    <message>
+        <location filename="filelistwidget.cpp" line="77"/>
+        <location filename="filelistwidget.cpp" line="119"/>
+        <location filename="filelistwidget.cpp" line="135"/>
+        <location filename="filelistwidget.cpp" line="167"/>
+        <source>Error!</source>
+        <translation>Virhe!</translation>
+    </message>
+    <message>
+        <location filename="filelistwidget.cpp" line="78"/>
+        <source>Renaming file %1 failed</source>
+        <translation>Tiedoston %1 uudelleen nimeäminen epäonnistui</translation>
+    </message>
+    <message>
+        <location filename="filelistwidget.cpp" line="120"/>
+        <source>Copying file %1 failed</source>
+        <translation>Tiedoston %1 kopiointi epäonnistui</translation>
+    </message>
+    <message>
+        <location filename="filelistwidget.cpp" line="136"/>
+        <source>Moving file %1 failed</source>
+        <translation>Tiedoston %1 siirto epäonnistui</translation>
+    </message>
+    <message>
+        <location filename="filelistwidget.cpp" line="156"/>
+        <source>Deleting file</source>
+        <translation>Tiedoston poisto</translation>
+    </message>
+    <message>
+        <location filename="filelistwidget.cpp" line="157"/>
+        <source>You are about to delete %1 file(s).
+Are you sure you want to continue?</source>
+        <translation>Olet poistamassa %1 tiedostoa.\nOletko varma että tahdot jatkaa?</translation>
+    </message>
+    <message>
+        <location filename="filelistwidget.cpp" line="168"/>
+        <source>Deleting file %1 failed</source>
+        <translation>Tiedoston %1 poistaminen epäonnistui</translation>
+    </message>
+    <message>
+        <location filename="filelistwidget.cpp" line="247"/>
+        <location filename="filelistwidget.cpp" line="264"/>
+        <source>Sending files</source>
+        <translation>Tiedostojen lähetys</translation>
+    </message>
+    <message>
+        <location filename="filelistwidget.cpp" line="248"/>
+        <source>To send files, select files you want to send and copy them.</source>
+        <translation>Lähettääksesi tiedostoja; valitse tiedostot, kopioi ja lähetä tiedostot.</translation>
+    </message>
+    <message>
+        <location filename="filelistwidget.cpp" line="265"/>
+        <source>Only in maemo5 for now</source>
+        <translation>Vain maemo5:ssä tällähetkellä</translation>
+    </message>
+</context>
+<context>
+    <name>MainWindow</name>
+    <message>
+        <location filename="mainwindow.ui" line="14"/>
+        <source>Maemo Explorer</source>
+        <translation>Maemo Explorer</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.ui" line="26"/>
+        <source>Up</source>
+        <translation>Ylös</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.ui" line="29"/>
+        <source>Backspace</source>
+        <translation>Backspace</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.ui" line="91"/>
+        <source>File</source>
+        <translation>Tiedosto</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.ui" line="74"/>
+        <source>Edit</source>
+        <translation>Muokkaa</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.ui" line="84"/>
+        <source>View</source>
+        <translation>Näkymä</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.ui" line="102"/>
+        <source>Exit</source>
+        <translation>Lopeta</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.ui" line="107"/>
+        <source>Cut</source>
+        <translation>Leikkaa</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.ui" line="112"/>
+        <source>Copy</source>
+        <translation>Kopioi</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.ui" line="117"/>
+        <source>Paste</source>
+        <translation>Liitä</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.ui" line="122"/>
+        <source>Delete</source>
+        <translation>Poista</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.ui" line="130"/>
+        <source>Icon view</source>
+        <translation>Kuvake näkymä</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.ui" line="148"/>
+        <source>Send files</source>
+        <translation>Lähetä tiedostoja</translation>
+    </message>
+    <message>
+        <source>Switch Mode</source>
+        <translation type="obsolete">Vaihda näkymä</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.ui" line="135"/>
+        <source>Rename</source>
+        <translation>Uudelleen nimeä</translation>
+    </message>
+    <message>
+        <location filename="mainwindow.ui" line="143"/>
+        <source>Show hidden</source>
+        <translation>Näytä piilotetut</translation>
+    </message>
+</context>
+</TS>
diff --git a/filelistwidget.cpp b/filelistwidget.cpp
new file mode 100644 (file)
index 0000000..22c75ea
--- /dev/null
@@ -0,0 +1,270 @@
+#include "filelistwidget.h"
+#include <QHeaderView>
+#include <QMessageBox>
+#include <QInputDialog>
+#include <QDesktopServices>
+#include <QUrl>
+#include <QProcess>
+#include <QDBusInterface>
+#ifdef Q_WS_MAEMO_5
+#   include <hildon-mime.h>
+#   include <dbus/dbus.h>
+#endif
+/*!
+Widget that shows filesystemmodel and handles navigation
+in directory tree and opening files with assosiated programs
+
+@todo in symbian and windows filesystems navigating to "/" wont show drives
+  */
+FileListWidget::FileListWidget(QWidget *parent) :
+    QListView(parent),
+    fileSystemModel( new QFileSystemModel(this)),
+    currentDir(QDir::homePath()),
+    mode_cut(false),
+    mode_copy(false),
+    select(false)
+{
+    this->setModel(fileSystemModel);
+    this->setRootIndex(fileSystemModel->index(currentDir.absolutePath()));
+    fileSystemModel->setRootPath(currentDir.absolutePath());
+    fileSystemModel->setFilter(fileSystemModel->filter() | QDir::System);
+    connect(this, SIGNAL(activated(QModelIndex)), this, SLOT(handleItemActivation(QModelIndex)));
+
+}
+
+/**
+  Switches view mode
+  @param iconmode true shows iconview, false shows listview
+  */
+void FileListWidget::actionSwitchMode(bool iconmode)
+{
+    if(iconmode) {
+        this->setViewMode(QListView::IconMode);
+        this->setWordWrap(true);
+        this->setGridSize(QSize(80,80));
+    } else {
+        this->setViewMode(QListView::ListMode);
+        this->setWordWrap(false);
+        this->setGridSize(QSize());
+    }
+}
+/**
+  Switches show hidden
+  @param show true shows hidden files
+  */
+void FileListWidget::actionShowHidden(bool show)
+{
+    if(show)
+        fileSystemModel->setFilter(fileSystemModel->filter() | QDir::Hidden);
+    else
+        fileSystemModel->setFilter(fileSystemModel->filter() &~ QDir::Hidden);
+
+    this->clearSelection();
+}
+
+/**
+  Rename selected file
+  */
+void FileListWidget::actionRename()
+{
+    QFileInfo file = fileSystemModel->fileInfo(this->selectedIndexes().first());
+    QString newName = QInputDialog::getText(this, tr("Rename"), tr("New filename: "), QLineEdit::Normal, file.fileName());
+    if(newName != file.fileName())
+    {
+        if(QFile::rename(file.absoluteFilePath(), file.absolutePath()+"/"+newName))
+            return;
+        else
+            QMessageBox::critical(this,tr("Error!")
+                                  ,tr("Renaming file %1 failed")
+                                    .arg(file.fileName())
+                                  ,QMessageBox::Ok);
+    }
+}
+/**
+  Selected files will be moved when actionPaste is called
+  */
+void FileListWidget::actionCut()
+{
+    mode_cut = true;
+    mode_copy = false;
+    selectedFiles = this->selectedIndexes();
+}
+/**
+  Selected files will be copied when actionPaste is called
+  */
+void FileListWidget::actionCopy()
+{
+    mode_cut = false;
+    mode_copy = true;
+    selectedFiles = this->selectedIndexes();
+}
+
+/**
+  Moves or copies files that were selected when actionCut or actionCopy called
+  */
+void FileListWidget::actionPaste()
+{
+    fileSystemModel->setReadOnly(false);
+    if(mode_copy) {
+        //Copy files until filelist is empty or error occured
+        while(!selectedFiles.isEmpty()) {
+            if(QFile::copy(fileSystemModel->fileInfo(selectedFiles.first()).absoluteFilePath()
+                        , fileSystemModel->rootPath()+"/"+fileSystemModel->fileName(selectedFiles.first()))) {
+                selectedFiles.removeFirst();
+            }
+            else if(QFile::copy(fileSystemModel->fileInfo(selectedFiles.first()).absoluteFilePath()
+                    , fileSystemModel->rootPath()+"/copy_"+fileSystemModel->fileName(selectedFiles.first()))) {
+                selectedFiles.removeFirst();
+            } else {
+                QMessageBox::critical(this,tr("Error!")
+                                      ,tr("Copying file %1 failed")
+                                        .arg(fileSystemModel->fileName(selectedFiles.first()))
+                                      ,QMessageBox::Ok);
+                break;
+            }
+        }
+        if(selectedFiles.isEmpty())
+            mode_copy = false;
+    } else if(mode_cut) {
+        //Move files until filelist is empty or error occured
+        while(!selectedFiles.isEmpty()) {
+            if(QFile::rename(fileSystemModel->fileInfo(selectedFiles.first()).absoluteFilePath()
+                        , fileSystemModel->rootPath()+"/"+fileSystemModel->fileName(selectedFiles.first()))) {
+                    selectedFiles.removeFirst();
+            } else {
+                QMessageBox::critical(this,tr("Error!")
+                                      ,tr("Moving file %1 failed")
+                                        .arg(fileSystemModel->fileName(selectedFiles.first()))
+                                      ,QMessageBox::Ok);
+                break;
+            }
+        }
+        if(selectedFiles.isEmpty())
+            mode_cut = false;
+    }
+    fileSystemModel->setReadOnly(true);
+    this->clearSelection();
+}
+
+/**
+  Deletes selected files
+  */
+void FileListWidget::actionDelete()
+{
+    mode_cut = false;
+    mode_copy = false;
+    if(QMessageBox::Yes == QMessageBox::warning(this, tr("Deleting file")
+                            ,tr("You are about to delete %1 file(s).\nAre you sure you want to continue?")
+                                .arg(this->selectedIndexes().count())
+                            , QMessageBox::Yes, QMessageBox::No)) {
+        fileSystemModel->setReadOnly(false);
+        selectedFiles = this->selectedIndexes();
+        //delete files until filelist empty or error occured
+        while(!selectedFiles.isEmpty()) {
+            if(fileSystemModel->remove(selectedFiles.first())) {
+                selectedFiles.removeFirst();
+            } else {
+                QMessageBox::critical(this,tr("Error!")
+                                      ,tr("Deleting file %1 failed")
+                                        .arg(fileSystemModel->fileName(selectedFiles.first()))
+                                      ,QMessageBox::Ok);
+                break;
+            }
+        }
+        fileSystemModel->setReadOnly(true);
+        this->clearSelection();
+    }
+}
+
+/**
+  @return Current directory
+  */
+QString FileListWidget::getPath()
+{
+    return currentDir.absolutePath();
+}
+
+/**
+  Changes current directory
+  @param path directory to change to
+  */
+void FileListWidget::changePath(QString path)
+{
+    currentDir.cd(path);
+    QString newPath = currentDir.absolutePath();
+    fileSystemModel->setRootPath(newPath);
+    this->clearSelection();
+    this->setRootIndex(fileSystemModel->index(newPath));
+    emit pathChanged(newPath);
+}
+
+/**
+  Equivalent to changePath("..")
+  */
+void FileListWidget::changePathUp()
+{
+    changePath("..");
+}
+
+void FileListWidget::handleItemActivation(QModelIndex index)
+{
+    if(!select) {
+        QFileInfo file = fileSystemModel->fileInfo(index);
+        if(file.isDir()) {
+            changePath(file.absoluteFilePath());
+        } else if(file.isExecutable()) {
+            // Make process
+            QProcess::startDetached(file.absoluteFilePath());
+        } else {
+#ifdef Q_WS_MAEMO_5 // Uses native file opening method
+            DBusConnection* conn;
+            conn = dbus_bus_get(DBUS_BUS_SESSION, 0);
+            hildon_mime_open_file(conn, QUrl::fromLocalFile(file.absoluteFilePath()).toEncoded().constData());
+#else
+            /*
+            Not working with maemo5.
+            Uses hildon_uri_open function from
+            libhildonmime which should work,
+            but all files opened in browser.
+            */
+            QDesktopServices::openUrl(QUrl::fromLocalFile(file.absoluteFilePath()));
+#endif
+        }
+    }
+}
+/**
+  @param mode true activates file selection
+  */
+void FileListWidget::setSelectMode(bool mode)
+{
+    select = mode;
+}
+
+void FileListWidget::actionSendFiles()
+{
+    if(!mode_copy) {
+        QMessageBox::information(this,
+                                 tr("Sending files"),
+                                 tr("To send files, select files you want to send and copy them."),
+                                 QMessageBox::Cancel);
+    } else {
+#ifdef Q_WS_MAEMO_5
+        // Create list of file urls
+        QStringList files;
+        while(!selectedFiles.isEmpty()) {
+            files.append(QUrl::fromLocalFile(fileSystemModel->fileInfo(selectedFiles.first()).absoluteFilePath()).toString());
+            selectedFiles.removeFirst();
+        }
+
+        // Make dbuscall to send files
+        QDBusInterface interface("com.nokia.bt_ui", "/com/nokia/bt_ui", "com.nokia.bt_ui",QDBusConnection::systemBus());
+        interface.call("show_send_file_dlg", files);
+#else
+        QMessageBox::information(this,
+                                 tr("Sending files"),
+                                 tr("Only in maemo5 for now"),
+                                 QMessageBox::Cancel);
+#endif
+    }
+}
+
diff --git a/filelistwidget.h b/filelistwidget.h
new file mode 100644 (file)
index 0000000..48304cf
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef FILELISTWIDGET_H
+#define FILELISTWIDGET_H
+
+#include <QListView>
+#include <QFileSystemModel>
+#include <QDir>
+#include <QMessageBox>
+#include <QKeyEvent>
+
+class FileListWidget : public QListView
+{
+Q_OBJECT
+public:
+    explicit FileListWidget(QWidget *parent = 0);
+
+    QString getPath();
+
+signals:
+    void pathChanged(QString newPath);
+
+public slots:
+    void changePath(QString path);
+    void changePathUp();
+
+    void actionDelete();
+    void actionCut();
+    void actionCopy();
+    void actionPaste();
+    void actionSwitchMode(bool iconmode=true);
+    void actionRename();
+    void actionShowHidden(bool show=true);
+    void actionSendFiles();
+
+    void setSelectMode(bool mode=true);
+private slots:
+    void handleItemActivation(QModelIndex index);
+
+private:
+    QFileSystemModel *fileSystemModel;
+    QDir currentDir;
+    QModelIndexList selectedFiles;
+    bool mode_cut;
+    bool mode_copy;
+    bool select;
+};
+
+#endif // FILELISTWIDGET_H
diff --git a/i18n.qrc b/i18n.qrc
new file mode 100644 (file)
index 0000000..9962489
--- /dev/null
+++ b/i18n.qrc
@@ -0,0 +1,5 @@
+<RCC>
+    <qresource prefix="/">
+        <file>cuteexplorertranslation_fi_FI.qm</file>
+    </qresource>
+</RCC>
diff --git a/main.cpp b/main.cpp
new file mode 100644 (file)
index 0000000..23f3386
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,29 @@
+#include <QtGui/QApplication>
+#include <QTranslator>
+#include <QLocale>
+#include "mainwindow.h"
+#include <QDebug>
+#include <QProcessEnvironment>
+int main(int argc, char *argv[])
+{
+    QApplication a(argc, argv);
+    QTranslator translator;
+
+    /* For some reason QLocale::system() returns
+    locale by LC_NUMERIC environment variable which is
+    meant for numerics like thousand separator etc.
+
+    In this solution we get locale from LANG environment variable
+    and use QLocale::system() as fallback.
+      */
+    if(QProcessEnvironment::systemEnvironment().contains("LANG"))
+        translator.load(":/cuteexplorertranslation_"+QLocale(QProcessEnvironment::systemEnvironment().value("LANG")).name());
+    else
+        translator.load(":/cuteexplorertranslation_"+QLocale::system().name());
+
+    a.installTranslator(&translator);
+
+    MainWindow w;
+    w.show();
+    return a.exec();
+}
diff --git a/mainwindow.cpp b/mainwindow.cpp
new file mode 100644 (file)
index 0000000..a6c94c3
--- /dev/null
@@ -0,0 +1,59 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+MainWindow::MainWindow(QWidget *parent) :
+    QMainWindow(parent),
+    ui(new Ui::MainWindow)
+{
+    ui->setupUi(this);
+    connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));
+    connect(ui->upButton, SIGNAL(clicked()), ui->fileListWidget, SLOT(changePathUp()));
+    connect(ui->locationLine, SIGNAL(returnPressed()), this, SLOT(locationLineEnterKeyHandler()));
+    connect(ui->fileListWidget, SIGNAL(pathChanged(QString)), ui->locationLine, SLOT(setText(QString)));
+    connect(ui->actionDelete, SIGNAL(triggered()), ui->fileListWidget, SLOT(actionDelete()));
+    connect(ui->actionMode, SIGNAL(toggled(bool)), ui->fileListWidget, SLOT(actionSwitchMode(bool)));
+    connect(ui->actionCopy, SIGNAL(triggered()), ui->fileListWidget, SLOT(actionCopy()));
+    connect(ui->actionCut, SIGNAL(triggered()), ui->fileListWidget, SLOT(actionCut()));
+    connect(ui->actionPaste, SIGNAL(triggered()), ui->fileListWidget, SLOT(actionPaste()));
+    connect(ui->actionShow_hidden, SIGNAL(toggled(bool)), ui->fileListWidget, SLOT(actionShowHidden(bool)));
+    connect(ui->actionRename, SIGNAL(triggered()), ui->fileListWidget, SLOT(actionRename()));
+    connect(ui->actionSend, SIGNAL(triggered()), ui->fileListWidget, SLOT(actionSendFiles()));
+    ui->locationLine->setText(ui->fileListWidget->getPath());
+}
+
+MainWindow::~MainWindow()
+{
+    delete ui;
+}
+
+void MainWindow::locationLineEnterKeyHandler()
+{
+    ui->fileListWidget->changePath(ui->locationLine->text());
+}
+void MainWindow::keyPressEvent(QKeyEvent *e)
+{
+    if(e->key() == Qt::Key_Control || e->key() == Qt::Key_Shift)
+        ui->fileListWidget->setSelectMode(true);
+    else
+        QMainWindow::keyPressEvent(e);
+}
+void MainWindow::keyReleaseEvent(QKeyEvent *e)
+{
+    if(e->key() == Qt::Key_Control || e->key() == Qt::Key_Shift)
+        ui->fileListWidget->setSelectMode(false);
+    else
+        QMainWindow::keyPressEvent(e);
+}
+
+void MainWindow::changeEvent(QEvent *e)
+{
+    QMainWindow::changeEvent(e);
+    switch (e->type()) {
+    case QEvent::LanguageChange:
+        ui->retranslateUi(this);
+        break;
+    default:
+        break;
+    }
+}
+
diff --git a/mainwindow.h b/mainwindow.h
new file mode 100644 (file)
index 0000000..8e9c517
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+namespace Ui {
+    class MainWindow;
+}
+
+class MainWindow : public QMainWindow {
+    Q_OBJECT
+public:
+    MainWindow(QWidget *parent = 0);
+    ~MainWindow();
+
+
+protected:
+    void changeEvent(QEvent *e);
+    void keyPressEvent(QKeyEvent *e);
+    void keyReleaseEvent(QKeyEvent *e);
+private slots:
+   void locationLineEnterKeyHandler();
+private:
+    Ui::MainWindow *ui;
+
+};
+
+#endif // MAINWINDOW_H
diff --git a/mainwindow.ui b/mainwindow.ui
new file mode 100644 (file)
index 0000000..2428f03
--- /dev/null
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>600</width>
+    <height>400</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>CuteExplorer</string>
+  </property>
+  <property name="locale">
+   <locale language="English" country="UnitedStates"/>
+  </property>
+  <widget class="QWidget" name="centralWidget">
+   <layout class="QVBoxLayout" name="verticalLayout">
+    <item>
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <item>
+       <widget class="QPushButton" name="upButton">
+        <property name="text">
+         <string>Up</string>
+        </property>
+        <property name="shortcut">
+         <string>Backspace</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLineEdit" name="locationLine"/>
+      </item>
+     </layout>
+    </item>
+    <item>
+     <layout class="QHBoxLayout" name="horizontalLayout_2">
+      <item>
+       <widget class="FileListWidget" name="fileListWidget">
+        <property name="contextMenuPolicy">
+         <enum>Qt::NoContextMenu</enum>
+        </property>
+        <property name="editTriggers">
+         <set>QAbstractItemView::NoEditTriggers</set>
+        </property>
+        <property name="showDropIndicator" stdset="0">
+         <bool>false</bool>
+        </property>
+        <property name="selectionMode">
+         <enum>QAbstractItemView::ExtendedSelection</enum>
+        </property>
+        <property name="textElideMode">
+         <enum>Qt::ElideRight</enum>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QMenuBar" name="menuBar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>600</width>
+     <height>21</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menuEdit">
+    <property name="title">
+     <string>Edit</string>
+    </property>
+    <addaction name="actionRename"/>
+    <addaction name="actionCut"/>
+    <addaction name="actionCopy"/>
+    <addaction name="actionPaste"/>
+    <addaction name="actionDelete"/>
+   </widget>
+   <widget class="QMenu" name="menuView">
+    <property name="title">
+     <string>View</string>
+    </property>
+    <addaction name="actionMode"/>
+    <addaction name="actionShow_hidden"/>
+   </widget>
+   <widget class="QMenu" name="menuFile">
+    <property name="title">
+     <string>File</string>
+    </property>
+    <addaction name="actionSend"/>
+    <addaction name="actionExit"/>
+   </widget>
+   <addaction name="menuFile"/>
+   <addaction name="menuEdit"/>
+   <addaction name="menuView"/>
+  </widget>
+  <action name="actionExit">
+   <property name="text">
+    <string>Exit</string>
+   </property>
+  </action>
+  <action name="actionCut">
+   <property name="text">
+    <string>Cut</string>
+   </property>
+  </action>
+  <action name="actionCopy">
+   <property name="text">
+    <string>Copy</string>
+   </property>
+  </action>
+  <action name="actionPaste">
+   <property name="text">
+    <string>Paste</string>
+   </property>
+  </action>
+  <action name="actionDelete">
+   <property name="text">
+    <string>Delete</string>
+   </property>
+  </action>
+  <action name="actionMode">
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
+   <property name="text">
+    <string>Icon view</string>
+   </property>
+  </action>
+  <action name="actionRename">
+   <property name="text">
+    <string>Rename</string>
+   </property>
+  </action>
+  <action name="actionShow_hidden">
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
+   <property name="text">
+    <string>Show hidden</string>
+   </property>
+  </action>
+  <action name="actionSend">
+   <property name="text">
+    <string>Send files</string>
+   </property>
+  </action>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <customwidgets>
+  <customwidget>
+   <class>FileListWidget</class>
+   <extends>QListView</extends>
+   <header>filelistwidget.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src.pro b/src.pro
new file mode 100644 (file)
index 0000000..03840aa
--- /dev/null
+++ b/src.pro
@@ -0,0 +1,45 @@
+# -------------------------------------------------
+# Project created by QtCreator 2010-01-13T19:38:20
+# -------------------------------------------------
+TARGET = cuteexplorer
+TEMPLATE = app
+
+SOURCES += main.cpp \
+    mainwindow.cpp \
+    filelistwidget.cpp
+HEADERS += mainwindow.h \
+    filelistwidget.h
+FORMS += mainwindow.ui
+TRANSLATIONS += cuteexplorertranslation_fi_FI.ts
+RESOURCES += i18n.qrc
+
+
+maemo5 {
+    #VARIABLES
+    CONFIG += link_pkgconfig
+    PKGCONFIG += dbus-1 gnome-vfs-2.0
+    LIBS += -lhildonmime -ldbus-1
+    QT += dbus
+    isEmpty(PREFIX) {
+        PREFIX = /usr
+  }
+BINDIR = $$PREFIX/bin
+DATADIR =$$PREFIX/share
+
+DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\"
+
+#MAKE INSTALL
+
+INSTALLS += target desktop icon icon64
+
+  target.path =$$BINDIR
+
+  desktop.path = $$DATADIR/applications/hildon
+  desktop.files += $${TARGET}.desktop
+
+  icon64.path = $$DATADIR/icons/hicolor/64x64/apps
+  icon64.files += $${TARGET}_icon64.png
+
+  icon.path = $$DATADIR/icons/hicolor/scalable/apps
+  icon.files += $${TARGET}_icon.svg
+}