Image frame bugs (trunk4.4) and possible solutions

Darío Andrés andresbajotierra at gmail.com
Wed Aug 12 20:15:50 CEST 2009


Hi !. I'm not really confidente about the code changes so I'm posting them here

* Issue 1:

In Frame, when a URL is not passed to the widget constructor it
creates an empty KUrl for "m_currentUrl" and that determines the frame
will use the "Default" image until a custom image url is set.
However, in the code, there are checks for "KUrl("Default")" which in
fact isn't there; so an empty(default) image is not detected; and this
causes some bugs (as: the "Open Image" menu option is shown and
enabled; and when it is clicked it fails as it tries to run KRun(empty
KUrl);

Proposed fix:
Use KUrl() (empty) and KUrl::isEmpty to check for the Default image
(see attached patch)

I just tried another solutions to show "Default" instead of blank in
the configuration dialog, but KUrl("Default") will try to fetch
"file://Default" so this would cause more issues later.

* Issue 2:

When a Frame is added, and you configurate it and select a Potd
provider. The first time this will fail. Also, if you reopen the
config dialog you will see that the current method is still "Image"
(this is, the changes were not saved)

Browsing the code I saw this in the saving function "configAccepted":


..   "m_potd = true" ..

   QString potdProvider =
m_configDialog->imageUi.potdComboBox->itemData(m_configDialog->imageUi.potdComboBox->currentIndex()).toString();

    if ((wasPotd && !m_potd) || (m_potd && potdProvider != m_potdProvider)) {
        // if we go from potd to no potd, or if the provider changes,
then we first want to
        // stop the potd engine
        stopPotd();
    }

    m_potdProvider = potdProvider;
    cg.writeEntry("potdProvider", m_potdProvider);
    cg.writeEntry("potd", m_potd);


The problem is that stopPotd() executes "m_potd=false" . So, even when
you set up the Potd mode to true, if this is the first time the if
shown above will be executed ( as "(m_potd && potdProvider !=
m_potdProvider)" is true) , stopPotd() will reset m_potd .. and then
"potd=false" will be set in the config file; causing this to fail.
The second time you do the same, the provider is already set, so the
second condition of the if() will also fail, stopPotd will *not* be
called, and the setting would be saved properly.

Possible fixes:
- Remove the "m_potd=false" statement from stopPotd() (I don't know
the extent of this function)
- modify the second condition of the if to not fail in this case.

I hope I explained the problems properly.
Regards!

Dario
BTW: I'm not suscribed to the ML, so please reply this to me too. Thanks!


More information about the Plasma-devel mailing list