This is an automatically generated e-mail. To reply, visit: http://git.reviewboard.kde.org/r/102290/

editors/imageviewer/imageviewer.h (Diff revision 2)
2
Copyright 2009 Riccardo Iaconelli <riccardo@kde.org>
this should have your name and email address

editors/imageviewer/imageviewer.h (Diff revision 2)
36
    void setDirectory(const KUrl& image);
37
    QString directory();
this should probably be setImage and QString image() const, since it doesn't actually set a directory to view but a specific image.

editors/imageviewer/imageviewer.h (Diff revision 2)
39
    void commonImages();
40
    void svgImages();
these could be private, or even merged into setImage

editors/imageviewer/imageviewer.cpp (Diff revision 2)
3
Copyright 2009-2010 Aaron Seigo <aseigo@kde.org>
4
Copyright 2009-2010 Artur Duque de Souza <asouza@kde.org>
5
Copyright 2009-2010 Laurent Montel <montel@kde.org>
6
Copyright 2009-2010 Shantanu Tushar Jha <jhahoneyk@gmail.com>
7
Copyright 2009-2010 Sandro Andrade <sandroandrade@kde.org>
8
Copyright 2009-2010 Lim Yuen Hoe <yuenhoe@hotmail.com>
this should have your name and email address instead

editors/imageviewer/imageviewer.cpp (Diff revision 2)
37
there is no layout (e.g. a QHBoxLayout) that the QLabel/QSvgWidget can be put into. this is why the image is showing up small and in the top corner.

editors/imageviewer/imageviewer.cpp (Diff revision 2)
48
    m_directory = image.path();
after setting the path, the code that is currently in init() should be called. i'd recommend getting rid fo the init() method, in fact, and merging it with this one.

editors/imageviewer/imageviewer.cpp (Diff revision 2)
71
    m_label = new QLabel(this);
72
    m_label->setPixmap(image);
this is a memory leak if commonImages() is called more than once. it should be something like:

if (!m_label) {
    m_label = new QLabel(this);
}

m_label->setPixmap(image);

this also implies initializing the m_label pointer to 0 in the constructor

editors/imageviewer/imageviewer.cpp (Diff revision 2)
77
    QSvgWidget image;
this should be new'd and added to the layout, otherwise the svg won't be visible, correct?

editors/imageviewer/imageviewer.cpp (Diff revision 2)
79
    image.renderer();
seems unnecessary 

mainwindow.cpp (Diff revision 2)
void MainWindow::loadImageViewer(const KUrl& target)
607
    if(m_imageViewer) {
608
        delete m_imageViewer;
609
    }
610
    m_imageViewer = new ImageViewer(this);
611
    m_imageViewer->setDirectory(target);
612
    m_imageViewer->init();
would it be better to do this as something like:

if (!m_imageViewer) {
    m_imageViewer = new ImageViewer(this);
    m_imageViewer->init();
}

m_imageViewer->setDirectory(target);
... etc

- Aaron J.


On September 28th, 2011, 8:39 p.m., Giorgos Tsiapaliwkas wrote:

Review request for Plasma and Aaron J. Seigo.
By Giorgos Tsiapaliwkas.

Updated Sept. 28, 2011, 8:39 p.m.

Description

hello,

without this patch a user cannot add an image with plasmate.

reproduce,go to files-images-new,the plasmate will open a text editor instead of a dialog,which(the dialog) is able to open an image.

With the patch a dialog will open asking for an image.

Testing

the patch is not ready yet,i have noted some questions.
Also the plasmate tries to open the image with a text editor.This have to be fixed,but how?Should we make plasmate able to preview images?

In addition,when you add something in the list of files(using the different options provided by the files qdockwidget) it names it as "new".This has to be fixed and the plasmate has to show the real name of the file.(different request,i just want an approval for this patch).

Diffs

  • CMakeLists.txt (f3f32a9)
  • editors/editpage.h (7b5dca3)
  • editors/editpage.cpp (d4b0082)
  • editors/imageviewer/imageviewer.h (PRE-CREATION)
  • editors/imageviewer/imageviewer.cpp (PRE-CREATION)
  • mainwindow.h (1b1c2a2)
  • mainwindow.cpp (3199f03)
  • packagemodel.cpp (8c0907a)

View Diff