Index: applets/frame/frame.h
===================================================================
--- applets/frame/frame.h	(révision 834138)
+++ applets/frame/frame.h	(copie de travail)
@@ -50,29 +50,37 @@
 
     public slots:
         void createConfigurationInterface( KConfigDialog *parent );
-	void dataUpdated( const QString &name, const Plasma::DataEngine::Data &data );
+        void dataUpdated( const QString &name, const Plasma::DataEngine::Data &data );
 
     protected Q_SLOTS:
         void dropEvent(QGraphicsSceneDragDropEvent *event);
         void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
         void configAccepted();
-        void updatePicture();
+        void nextPicture();
+        void previousPicture();
 
     private Q_SLOTS:
         void addDir();
         void removeDir();
+        void displayBrowseLabels();
+        void updateLabelsSize();
 
     protected:
         void constraintsEvent(Plasma::Constraints constraints);
+        virtual void hoverEnterEvent(QGraphicsSceneHoverEvent* event);
+        virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent* event);
+        virtual void hoverMoveEvent(QGraphicsSceneHoverEvent* event);
+        virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
 
     private:
         void paintCache(const QStyleOptionGraphicsItem *option,
                         const QSize &contentsSize);
         void initSlideShow();
+        void paintLabel(QPainter* p, int x, int y, const QString& text, bool highlight) const;
 
         /// The current color of the frame
         QColor m_frameColor;
-	/// Configuration dialog
+        /// Configuration dialog
         ConfigDialog *m_configDialog; 
         /// true if the user wants a frame. If false, there's only the black border around the picture
         bool m_frame;
@@ -82,9 +90,9 @@
         bool m_smoothScaling;
         /// If true, the picture will have a drop shadow.
         bool m_shadow;
-	/// PoTD
-	QString m_potdProvider;
-	bool m_potd;
+        /// PoTD
+        QString m_potdProvider;
+        bool m_potd;
         /// Stores the current picture URL when slideShow is false. Wikipedia Picture of the Day is default.
         KUrl m_currentUrl;
         /// The current slideshow folder
@@ -104,6 +112,14 @@
         bool m_random;
         bool m_recursiveSlideShow;
         SlideShow* m_mySlideShow;
+        /// Flag set to true if the "Previous" label must be displayed
+        bool m_highlightPreviousLabel;
+        /// Flag set to true if the "Next" label must be displayed
+        bool m_highlightNextLabel;
+        /// Timer used to delay labels display after the mouse cursor enters the plasmoid.
+        QTimer* m_displayLabelsTimer;
+        /// Next / Previous label size
+        QSize m_labelSize;
 };
 
 K_EXPORT_PLASMA_APPLET(frame, Frame)
Index: applets/frame/slideshow.cpp
===================================================================
--- applets/frame/slideshow.cpp	(révision 834138)
+++ applets/frame/slideshow.cpp	(copie de travail)
@@ -23,14 +23,13 @@
 
 #include "picture.h"
 #include "slideshow.h"
-#include <stdlib.h>
 
 SlideShow::SlideShow()
 {
     m_filters << "*.jpeg" << "*.jpg" << "*.png" << "*.svg" << "*.svgz"; // use mime types?
     m_slideNumber = 0;
-    useRandom = false;
-    randomInt = 0;
+    m_useRandom = false;
+    m_randomInt = 0;
 }
 
 SlideShow::~SlideShow()
@@ -39,7 +38,7 @@
 
 void SlideShow::setRandom(bool tmp)
 {
-	useRandom = tmp;
+    m_useRandom = tmp;
 }
 
 void SlideShow::setDirs(const QStringList &slideShowPath, bool recursive)
@@ -63,7 +62,7 @@
 void SlideShow::addImage(const QString &imagePath)
 {
     if (!m_pictures.contains(imagePath)) {
-	    m_pictures.append(imagePath);
+        m_pictures.append(imagePath);
     }
 }
 
@@ -73,18 +72,19 @@
 
     dir.setNameFilters(m_filters);
     if (dir.entryList().isEmpty())  {
-	//TODO remove the path from the list
-	return;
+    //TODO remove the path from the list
+    return;
     }
     foreach (const QString &imageFile, dir.entryList(QDir::Files)) {
-	    addImage(path + "/" + imageFile);
+        addImage(path + "/" + imageFile);
     }
     KRandomSequence randomSequence;
-    indexList.clear();
+    m_indexList.clear();
     //get the number of sounds then shuffle it: each number will be taken once then the sequence will come back
-    for (uint j = 0; j < m_pictures.count(); j++) 
-	indexList.append(j);
-    randomSequence.randomize(indexList);
+    for (int j = 0; j < m_pictures.count(); j++) {
+        m_indexList.append(j);
+    }
+    randomSequence.randomize(m_indexList);
 }
 
 void SlideShow::addRecursiveDir(const QString &path)
@@ -97,28 +97,34 @@
     }
 }
 
-QImage SlideShow::getImage() 
+QImage SlideShow::nextImage() 
 {
-    KUrl url = getUrl();
+    KUrl url = getUrl(1);
     Picture myPicture;
     return myPicture.setPicture(url);
 }
 
-KUrl SlideShow::getUrl() 
+QImage SlideShow::previousImage()
 {
+    KUrl url = getUrl(-1);
+    Picture myPicture;
+    return myPicture.setPicture(url);
+}
+
+KUrl SlideShow::getUrl(int delta)
+{
     if (!m_pictures.isEmpty()) {
-
-	    int index = -1;
-	    if(useRandom) {
-		    randomInt++;
-		    index = indexList[randomInt%m_pictures.count()];
-		    kDebug() << "Random was selected and the index was: " << index << " out of " << m_pictures.count() << " images" << endl;
-	    } else {
-		    index = m_slideNumber++ % m_pictures.count();
-	    }
-
-	    return KUrl(m_pictures.at(index));
+        int index = -1;
+        if(m_useRandom) {
+            m_randomInt += delta;
+            index = m_indexList[m_randomInt % m_pictures.count()];
+            kDebug() << "Random was selected and the index was: " << index << " out of " << m_pictures.count() << " images" << endl;
+        } else {
+            m_slideNumber += delta;
+            index = m_slideNumber % m_pictures.count();
+        }
+        return KUrl(m_pictures.at(index));
     } else {
-	    return KUrl("Default");
+        return KUrl("Default");
     }
 }
Index: applets/frame/slideshow.h
===================================================================
--- applets/frame/slideshow.h	(révision 834138)
+++ applets/frame/slideshow.h	(copie de travail)
@@ -23,35 +23,33 @@
 #include <QString>
 #include <QStringList>
 #include <QImage>
-#include <math.h>
-#include <iostream>
 
 class KUrl;
 
 class SlideShow
 {
-	public:
-		SlideShow();
-		~SlideShow();
-		
-		void setDirs(const QStringList &slideShowPaths, bool recursive = false);
-		void setImage(const QString &imagePath);
-		void setRandom(bool);
-		QImage getImage();
-		
-	private:
-		QStringList m_pictures;
-		QStringList m_filters;
-		int m_slideNumber;
-		bool useRandom;
-		
-		void addImage(const QString &imagePath);
-		void addDir(const QString &path);
-		void addRecursiveDir(const QString &path);
-		KUrl getUrl();
-		QList<int> indexList;
-		int randomInt;
+    public:
+        SlideShow();
+        ~SlideShow();
+    
+        void setDirs(const QStringList &slideShowPaths, bool recursive = false);
+        void setImage(const QString &imagePath);
+        void setRandom(bool);
+        QImage nextImage();
+        QImage previousImage();
+    
+    private:
+        void addImage(const QString &imagePath);
+        void addDir(const QString &path);
+        void addRecursiveDir(const QString &path);
+        KUrl getUrl(int delta);
 
+        QStringList m_pictures;
+        QStringList m_filters;
+        uint m_slideNumber;
+        bool m_useRandom;
+        QList<int> m_indexList;
+        uint m_randomInt;
 };
 
 #endif /*SLIDESHOW_H_*/
Index: applets/frame/frame.cpp
===================================================================
--- applets/frame/frame.cpp	(révision 834138)
+++ applets/frame/frame.cpp	(copie de travail)
@@ -47,7 +47,24 @@
 
 Frame::Frame(QObject *parent, const QVariantList &args)
     : Plasma::Applet(parent, args),
-      m_configDialog( 0 )
+      m_configDialog(NULL),
+      m_frame(false),
+      m_roundCorners(false),
+      m_smoothScaling(false),
+      m_shadow(false),
+      m_potd(false),
+      m_slideNumber(0),
+      m_slideShowTimer(NULL),
+      m_slideshowTime(0),
+      m_frameOutline(0),
+      m_swOutline(0),
+      m_slideShow(false),
+      m_random(false),
+      m_recursiveSlideShow(false),
+      m_mySlideShow(NULL),
+      m_highlightPreviousLabel(false),
+      m_highlightNextLabel(false),
+      m_displayLabelsTimer(NULL)
 {
     setHasConfigurationInterface(true);
     setAcceptDrops(true);
@@ -60,6 +77,14 @@
     } else {
         m_currentUrl = KUrl("Default");
     }
+
+    updateLabelsSize();
+    connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(updateLabelsSize()));
+
+    m_displayLabelsTimer = new QTimer(this);
+    m_displayLabelsTimer->setInterval(800);
+    m_displayLabelsTimer->setSingleShot(true);
+    connect(m_displayLabelsTimer, SIGNAL(timeout()), this, SLOT(displayBrowseLabels()));
 }
 
 Frame::~Frame()
@@ -69,15 +94,17 @@
 
 void Frame::dataUpdated( const QString &name, const Plasma::DataEngine::Data &data )
 {
+    Q_UNUSED(name);
+
     QDate mCurrentDate = QDate::currentDate();
     const QString identifier = m_potdProvider + ':' + mCurrentDate.toString( Qt::ISODate );
 
     QImage _picture = data[ identifier ].value<QImage>();
     
     if ( !_picture.isNull() ) {
-	m_picture = _picture;
-	resize(contentSizeHint());
-	m_pixmapCache = QPixmap();
+    m_picture = _picture;
+    resize(contentSizeHint());
+    m_pixmapCache = QPixmap();
         prepareGeometryChange();
         updateGeometry();
         update();
@@ -114,7 +141,7 @@
 
     // Initialize the slideshow timer
     m_slideShowTimer = new QTimer(this);
-    connect(m_slideShowTimer, SIGNAL(timeout()), this, SLOT(updatePicture()));
+    connect(m_slideShowTimer, SIGNAL(timeout()), this, SLOT(nextPicture()));
     m_slideShowTimer->setInterval(m_slideshowTime * 1000);
 
     initSlideShow();
@@ -131,6 +158,61 @@
     }
 }
 
+void Frame::hoverEnterEvent(QGraphicsSceneHoverEvent* event)
+{
+    Applet::hoverEnterEvent(event);
+    if (contentsRect().contains(event->pos())) {
+        m_displayLabelsTimer->start();
+    }
+}
+
+void Frame::hoverLeaveEvent(QGraphicsSceneHoverEvent* event)
+{
+    Applet::hoverLeaveEvent(event);
+    m_highlightPreviousLabel = false;
+    m_highlightNextLabel = false;
+    if (m_slideShow) {
+        m_pixmapCache = QPixmap();
+        update();
+    }
+    m_displayLabelsTimer->stop();
+}
+
+void Frame::hoverMoveEvent(QGraphicsSceneHoverEvent* event)
+{
+    Applet::hoverMoveEvent(event);
+    if (contentsRect().contains(event->pos())) {
+        bool old = m_highlightPreviousLabel;
+        m_highlightPreviousLabel = event->pos().x() < contentsRect().size().width() / 2;
+        m_highlightNextLabel = !m_highlightPreviousLabel;
+        if (m_slideShow && m_highlightPreviousLabel != old) {
+            m_pixmapCache = QPixmap();
+            update();
+        }
+    } else {
+        m_highlightPreviousLabel = false;
+        m_highlightNextLabel = false;
+        if (m_slideShow) {
+            m_pixmapCache = QPixmap();
+            update();
+        }
+        m_displayLabelsTimer->stop();
+    }
+}
+
+void Frame::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+    Applet::mousePressEvent(event);
+    if (m_slideShow && event->buttons() & Qt::LeftButton) {
+        if (m_highlightPreviousLabel) {
+            previousPicture();
+        } else {
+            nextPicture();
+        }
+        m_slideShowTimer->start();
+    }
+}
+
 QSizeF Frame::contentSizeHint() const {
     if (!m_picture.isNull()) {
         QSizeF sizeHint;
@@ -146,14 +228,22 @@
     }
 }
 
-void Frame::updatePicture()
+void Frame::nextPicture()
 {
-    m_picture = m_mySlideShow->getImage();
+    m_picture = m_mySlideShow->nextImage();
     resize(contentSizeHint());
     m_pixmapCache = QPixmap();
     update();
 }
 
+void Frame::previousPicture()
+{
+    m_picture = m_mySlideShow->previousImage();
+    resize(contentSizeHint());
+    m_pixmapCache = QPixmap();
+    update();    
+}
+
 void Frame::addDir()
 {
     KDirSelectDialog dialog(KUrl(), true);
@@ -177,15 +267,33 @@
     }
 }
 
+void Frame::displayBrowseLabels()
+{
+    if (m_slideShow) {
+        m_pixmapCache = QPixmap();
+        update();
+    }
+}
+
+void Frame::updateLabelsSize()
+{
+    QRect prevBr(Plasma::Theme::defaultTheme()->fontMetrics().boundingRect(tr("Previous")));
+    prevBr.adjust(0, 0, 10, 10);
+    QRect nextBr(Plasma::Theme::defaultTheme()->fontMetrics().boundingRect(tr("Next")));
+    nextBr.adjust(0, 0, 10, 10);
+    m_labelSize.setWidth(qMax(prevBr.width(), nextBr.width()));
+    m_labelSize.setHeight(qMax(prevBr.height(), nextBr.height()));
+}
+
 void Frame::createConfigurationInterface(KConfigDialog *parent)
 {
     m_configDialog = new ConfigDialog( parent );
     
     KService::List services = KServiceTypeTrader::self()->query( "PlasmaPoTD/Plugin");
     foreach (const KService::Ptr &service, services) {
-	const QString *service_name = new QString ( service->name() );
-	const QVariant *service_identifier = new QVariant ( service->property( "X-KDE-PlasmaPoTDProvider-Identifier", QVariant::String ).toString() );
-	m_configDialog->ui.potdComboBox->insertItem( m_configDialog->ui.potdComboBox->count(), *service_name, *service_identifier );
+    const QString *service_name = new QString ( service->name() );
+    const QVariant *service_identifier = new QVariant ( service->property( "X-KDE-PlasmaPoTDProvider-Identifier", QVariant::String ).toString() );
+    m_configDialog->ui.potdComboBox->insertItem( m_configDialog->ui.potdComboBox->count(), *service_name, *service_identifier );
     }
 
     parent->setButtons(  KDialog::Ok | KDialog::Cancel | KDialog::Apply);
@@ -205,11 +313,11 @@
     m_configDialog->setFrameColor(m_frameColor);
 
     if (m_slideShow)
-	m_configDialog->ui.pictureComboBox->setCurrentIndex(1);
+    m_configDialog->ui.pictureComboBox->setCurrentIndex(1);
     else if (m_potd)
-	m_configDialog->ui.pictureComboBox->setCurrentIndex(2);
+    m_configDialog->ui.pictureComboBox->setCurrentIndex(2);
     else
-	m_configDialog->ui.pictureComboBox->setCurrentIndex(0);
+    m_configDialog->ui.pictureComboBox->setCurrentIndex(0);
 
     m_configDialog->ui.randomCheckBox->setCheckState(m_random ? Qt::Checked : Qt::Unchecked);
     m_configDialog->ui.recursiveCheckBox->setCheckState(m_recursiveSlideShow ? Qt::Checked : Qt::Unchecked);
@@ -244,14 +352,14 @@
 
     if (m_configDialog->ui.pictureComboBox->currentIndex() == 1)
     {
-	m_slideShow = true;
-	m_potd = false;
+    m_slideShow = true;
+    m_potd = false;
     }  else if (m_configDialog->ui.pictureComboBox->currentIndex() == 2)   {
-	m_slideShow = false;
-	m_potd = true;
+    m_slideShow = false;
+    m_potd = true;
     }  else {
-	m_slideShow = false;
-	m_potd = false;
+    m_slideShow = false;
+    m_potd = false;
     }
 
     m_random = m_configDialog->random();
@@ -285,28 +393,28 @@
 void Frame::initSlideShow()
 {
     if (m_slideShow) {
-	    m_mySlideShow->setDirs(m_slideShowPaths, m_recursiveSlideShow);
+        m_mySlideShow->setDirs(m_slideShowPaths, m_recursiveSlideShow);
             m_mySlideShow->setRandom(m_random);
-	    m_slideShowTimer->start();
+        m_slideShowTimer->start();
     } else if (m_potd) {
-	Plasma::DataEngine *engine = dataEngine( "potd" );
-	if ( !engine )
-	    return;
+    Plasma::DataEngine *engine = dataEngine( "potd" );
+    if ( !engine )
+        return;
 
-	QDate mCurrentDate = QDate::currentDate();
-	const QString identifier = m_potdProvider + ':' + mCurrentDate.toString( Qt::ISODate );
+    QDate mCurrentDate = QDate::currentDate();
+    const QString identifier = m_potdProvider + ':' + mCurrentDate.toString( Qt::ISODate );
     
-	engine->disconnectSource( identifier, this );
-	engine->connectSource( identifier, this );
+    engine->disconnectSource( identifier, this );
+    engine->connectSource( identifier, this );
     
-	const Plasma::DataEngine::Data data = engine->query( identifier );
+    const Plasma::DataEngine::Data data = engine->query( identifier );
     } else {
-	    m_mySlideShow->setImage(m_currentUrl.path());
-	    m_slideShowTimer->stop();
+        m_mySlideShow->setImage(m_currentUrl.path());
+        m_slideShowTimer->stop();
     }
     
     if (!m_potd)
-	updatePicture();
+        nextPicture();
 }
 
 void Frame::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
@@ -324,7 +432,7 @@
     KUrl droppedUrl = (KUrl::List::fromMimeData(event->mimeData())).at(0);
     // If the url is a local directory start slideshowmode
     if (droppedUrl.isLocalFile() && QFileInfo(droppedUrl.path()).isDir()) {
-    	m_slideShowPaths.append(droppedUrl.path());
+        m_slideShowPaths.append(droppedUrl.path());
         if (!m_slideShow) {
             m_slideShow = true;
         }
@@ -435,7 +543,42 @@
         p->drawPath(framePath);
     }
 
+    if (m_slideShow && !m_displayLabelsTimer->isActive() && (m_highlightPreviousLabel || m_highlightNextLabel)) {
+        paintLabel(p, frameRect.x(), frameRect.y() + frameRect.height() / 4, tr("Previous"), m_highlightPreviousLabel);
+        paintLabel(p, frameRect.x() + frameRect.width() - m_labelSize.width(), frameRect.y() + frameRect.height() / 4, tr("Next"), m_highlightNextLabel);
+    }
     delete p;
 }
 
+void Frame::paintLabel(QPainter* p, int x, int y, const QString& text, bool highlight) const
+{
+    QPen oldPen(p->pen());
+    QBrush oldBrush(p->brush());
+
+    Plasma::Theme* theme = Plasma::Theme::defaultTheme();
+
+    int alpha = 0;
+    if (highlight) {
+        alpha = 192;
+    } else {
+        alpha = 96;
+    }
+    
+    QColor c(theme->color(Plasma::Theme::BackgroundColor));
+    c.setAlpha(alpha);
+    p->setPen(Qt::NoPen);
+    p->setBrush(c);
+    p->drawRect(x, y, m_labelSize.width(), m_labelSize.height());
+    c = theme->color(Plasma::Theme::TextColor);
+    c.setAlpha(alpha);
+    p->setPen(c);
+    p->setBrush(c);
+    p->setFont(theme->font(Plasma::Theme::DefaultFont));
+    p->drawText(x, y, m_labelSize.width(), m_labelSize.height(), Qt::AlignCenter, text);
+    
+    p->setPen(oldPen);
+    p->setBrush(oldBrush);
+}
+
 #include "frame.moc"
+
