commit b489456cb7095d406b224e2eec943af62edebafb
Author: Eric Seigne <eric.seigne@ryxeo.com>
Date:   Mon Jun 4 22:56:50 2012 +0200

    menu contextuel + images

diff --git a/images/background.jpg b/images/background.jpg
deleted file mode 100644
index fde923e..0000000
Binary files a/images/background.jpg and /dev/null differ
diff --git a/images/folder_add.png b/images/folder_add.png
new file mode 100644
index 0000000..529fe8f
Binary files /dev/null and b/images/folder_add.png differ
diff --git a/images/folder_delete.png b/images/folder_delete.png
new file mode 100644
index 0000000..112b016
Binary files /dev/null and b/images/folder_delete.png differ
diff --git a/images/folder_edit.png b/images/folder_edit.png
new file mode 100644
index 0000000..ad669cc
Binary files /dev/null and b/images/folder_edit.png differ
diff --git a/original.cpp b/original.cpp
index d8170c1..0b73995 100644
--- a/original.cpp
+++ b/original.cpp
@@ -62,6 +62,25 @@ original::original(QWidget *parent) :
         item->setText(0, list.at(i).fileName());
         item->setData(1,0,list.at(i).absoluteFilePath());
     }
+
+    //============== le menu contextuel du treewidget (gauche)
+    m_menu = new QMenu(ui->treeWidget);
+    QList<QAction*> actions;
+
+    QAction *a_nouveau = new QAction(QIcon(":/images/folder_add.png"),trUtf8("&Nouvel album"),m_menu);
+    a_nouveau->setIconVisibleInMenu(true);
+    a_nouveau->connect(a_nouveau, SIGNAL(triggered()), this, SLOT(on_action_Nouvel_album_triggered()));
+
+    QAction *a_renommer = new QAction(QIcon(":/images/folder_edit.png"),trUtf8("&Renommer..."),m_menu);
+    a_renommer->setIconVisibleInMenu(true);
+    //a_renommer->connect(a_renommer, SIGNAL(triggered()), this, SLOT(on_action_Nouvel_album_triggered()));
+
+    QAction *a_supprimer = new QAction(QIcon(":/images/folder_delete.png"),trUtf8("&Supprimer..."),m_menu);
+    a_supprimer->setIconVisibleInMenu(true);
+    //a_supprimer->connect(a_supprimer, SIGNAL(triggered()), this, SLOT(on_action_Nouvel_album_triggered()));
+
+    actions << a_nouveau << a_renommer << a_supprimer;
+    m_menu->addActions(actions);
 }
 
 original::~original()
@@ -286,3 +305,9 @@ void original::on_btnSave_clicked()
     out << data;
     file.close();
 }
+
+
+void original::on_treeWidget_customContextMenuRequested(const QPoint &pos)
+{
+    m_menu->exec(ui->treeWidget->mapToGlobal(pos));
+}
diff --git a/original.h b/original.h
index 45d4e22..3f971a1 100644
--- a/original.h
+++ b/original.h
@@ -31,6 +31,7 @@
 #include <exiv2/exif.hpp>
 #include <QTreeWidgetItem>
 #include <QListWidgetItem>
+#include <QMenu>
 
 namespace Ui {
 class original;
@@ -51,8 +52,11 @@ private slots:
     void on_commandLinkButton_clicked();
     void on_btnSave_clicked();
 
+    void on_treeWidget_customContextMenuRequested(const QPoint &pos);
+
 private:
     Ui::original *ui;
+    QMenu *m_menu;
 };
 
 #endif // ORIGINAL_H
diff --git a/original.ui b/original.ui
index b27f736..580d39a 100644
--- a/original.ui
+++ b/original.ui
@@ -193,6 +193,9 @@
         <height>16777215</height>
        </size>
       </property>
+      <property name="contextMenuPolicy">
+       <enum>Qt::CustomContextMenu</enum>
+      </property>
       <property name="editTriggers">
        <set>QAbstractItemView::AllEditTriggers</set>
       </property>
@@ -254,12 +257,19 @@
    </property>
   </action>
   <action name="action_Nouvel_album">
+   <property name="icon">
+    <iconset resource="resources.qrc">
+     <normaloff>:/images/folder_add.png</normaloff>:/images/folder_add.png</iconset>
+   </property>
    <property name="text">
     <string>&amp;Nouvel album</string>
    </property>
    <property name="shortcut">
     <string>Ctrl+N</string>
    </property>
+   <property name="iconVisibleInMenu">
+    <bool>true</bool>
+   </property>
   </action>
  </widget>
  <layoutdefault spacing="6" margin="11"/>
@@ -278,7 +288,9 @@
   <tabstop>treeWidget</tabstop>
   <tabstop>lwPictures</tabstop>
  </tabstops>
- <resources/>
+ <resources>
+  <include location="resources.qrc"/>
+ </resources>
  <connections>
   <connection>
    <sender>action_Quiter</sender>
diff --git a/resources.qrc b/resources.qrc
index 26e0802..6738c2a 100644
--- a/resources.qrc
+++ b/resources.qrc
@@ -1,5 +1,7 @@
 <RCC>
     <qresource prefix="/">
-        <file>images/background.jpg</file>
+        <file>images/folder_delete.png</file>
+        <file>images/folder_add.png</file>
+        <file>images/folder_edit.png</file>
     </qresource>
 </RCC>
