Actually, I think the right approach is to use the static 
KPassivePopup::message function.  One form of the function takes a 
QSystemTrayIcon* as a parent parameter (instead of a QWidget*), so I think 
that's what we should use.  I'll try to commit it tonight.

This would allow us to continue using the custom icon, etc.  

Thanks for your excellent work on this, Jon.  I haven't had the time to really 
dig into this because of classes, so I especially appreciate your putting some 
effort into fixing this problem.

Robert

On Friday 05 March 2010 8:21:23 am Jon Mease wrote:
> Hello again,
>      So I've looked over this a little more this morning and I think I
> have a solution (not necessarily the solution, that's up for
> discussion of course).  I compared
> BNPView::showPassiveDroppedDelayed() to basket v1.0.3 and it's
> identical.  The difference is that before when using KDE3 our
> SystemTray inherited from KSystemTray which inherited from QLabel
> which is a QWidget so there was no problem using our
> Global::systemTray as the parent of the KPassivePopup.  But as of KDE4
> it seems that KSystemTray has gone away in favor of KSystemTrayIcon
> which is no longer a QWidget.  So as a proof of concept this patch
> first checks whether we're going to use the system tray, and if so
> calls systemTray->showMessage() rather than creating a KPassivePopup.
> QSystemTray->ShowMessage is more limited than KPassivePopup (no custom
> icons for example), but it looks like a very native system tray popup.
> 
> Comments/Concerns?  If we do want to do something like this there are
> another three or four places in bnpview.cpp where we have the same
> KPassivePopup constructor line that should also be modified.
> 
> -Jon
> 
> 
> =====PATCH=====
> diff --git a/src/bnpview.cpp b/src/bnpview.cpp
> index 5fbb3f0..6554eff 100644
> --- a/src/bnpview.cpp
> +++ b/src/bnpview.cpp
> @@ -2308,19 +2308,25 @@ void BNPView::showPassiveDroppedDelayed()
> 
>      QString title = m_passiveDroppedTitle;
> 
> -    delete m_passivePopup; // Delete previous one (if exists): it
> will then hide it (only one at a time)
> -    m_passivePopup = new KPassivePopup(Settings::useSystray() ?
> (QWidget*)Global::systemTray : this);
> -    QImage contentsImage =
> NoteDrag::feedbackPixmap(m_passiveDroppedSelection).toImage();
> -    QResource::registerResource(contentsImage.bits(),
> ":/images/passivepopup_image");
> -    m_passivePopup->setView(
> -       
>  title.arg(Tools::textToHTMLWithoutP(currentBasket()->basketName())), -    
>     (contentsImage.isNull() ? "" : "<img
> src=\":/images/passivepopup_image\">"),
> -        KIconLoader::global()->loadIcon(
> -            currentBasket()->icon(), KIconLoader::NoGroup, 16,
> -            KIconLoader::DefaultState, QStringList(), 0L, true
> -        )
> -    );
> -    m_passivePopup->show();
> +    if (!Settings::useSystray()) {
> +        delete m_passivePopup; // Delete previous one (if exists): it
> will then hide it (only one at a time)
> +        m_passivePopup = new KPassivePopup(this);
> +        QImage contentsImage =
> NoteDrag::feedbackPixmap(m_passiveDroppedSelection).toImage();
> +        QResource::registerResource(contentsImage.bits(),
> ":/images/passivepopup_image");
> +        m_passivePopup->setView(
> +           
>  title.arg(Tools::textToHTMLWithoutP(currentBasket()->basketName())), +    
>         (contentsImage.isNull() ? "" : "<img
> src=\":/images/passivepopup_image\">"),
> +            KIconLoader::global()->loadIcon(
> +                currentBasket()->icon(), KIconLoader::NoGroup, 16,
> +                KIconLoader::DefaultState, QStringList(), 0L, true
> +            )
> +        );
> +        m_passivePopup->show();
> +    } else {
> +        Global::systemTray->showMessage("Grabbed screen zone...",
> +                                                QString("to basket ")
> + Tools::textToHTMLWithoutP(currentBasket()->basketName()),
> +
> QSystemTrayIcon::Information, 4000);
> +    }
>  }
> 
>  void BNPView::showPassiveImpossible(const QString &message)
> 
> ---------------------------------------------------------------------------
> --- Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Basket-devel mailing list
> Basket-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/basket-devel
> 

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Basket-devel mailing list
Basket-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/basket-devel

Reply via email to