On Thursday 06 August 2009, Shantanu Tushar Jha wrote:
> Hi,
> I had fixed the non-appearance of Open Picture... option in Picture
> Frame's right-click menu ( r990567and r991008 ). But weirdly,
> sometimes there are two instances of the Open Picture... option. But,
> the code does check for it that multiple options aren't added (using
> the variable m_menuPresent ) -
>
>  if (hasAuthorization("LaunchApp") && ! (m_menuPresent || m_potd ||
> (m_currentUrl.path() == "Default" && m_mySlideShow->currentUrl() ==
> "Default")))

i assume the missing '{' is just an accident :)

anyways, the logic of this if statement is pretty complex. personally, i'd 
write it like this:

const bool invalid = m_currentUrl.path() == "Default" && 
                     m_mySlideShow->currentUrl() == "Default";

if (m_potd || invalid) {
    delete m_openPicture;
    m_openPicture = 0;
} else if (!m_openPicture && hasAuthorization("LaunchApp")) {
   ...
}

does the same thing, but so much easier to read and understand imho. note that 
this also gets rid of the need for m_menuPresent.

> I tried a lot to figure it out, but the maximum i can guess is that
> the code is getting run twice simultaneously. 

that's not possible. maybe put some debug input in there that shows the values 
of what's being used in the if/else statements.

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Software

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel

Reply via email to