summaryrefslogtreecommitdiff
path: root/libopie2/opieui/opopupmenu.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opieui/opopupmenu.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/opopupmenu.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/libopie2/opieui/opopupmenu.cpp b/libopie2/opieui/opopupmenu.cpp
index 3ab8490..50c613f 100644
--- a/libopie2/opieui/opopupmenu.cpp
+++ b/libopie2/opieui/opopupmenu.cpp
@@ -8,33 +8,33 @@
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-/* QT */
+/* OPIE */
+#include <opie2/opopupmenu.h>
+#include <opie2/oconfig.h>
+#include <opie2/odebug.h>
+/* QT */
#include <qdrawutil.h>
#include <qtimer.h>
-/* OPIE */
-
-#include <opie2/opopupmenu.h>
-#include <opie2/oconfig.h>
using namespace Opie::Core;
using namespace Opie::Ui;
OPopupTitle::OPopupTitle(QWidget *parent, const char *name)
: QWidget(parent, name)
{
setMinimumSize(16, fontMetrics().height()+8);
}
OPopupTitle::OPopupTitle(OPixmapEffect::GradientType /* gradient */,
const QColor &/* color */, const QColor &/* textColor */,
@@ -123,25 +123,25 @@ QSize OPopupTitle::sizeHint() const
}
class OPopupMenu::OPopupMenuPrivate
{
public:
OPopupMenuPrivate ()
: noMatches(false)
, shortcuts(false)
, autoExec(false)
, lastHitIndex(-1)
, m_ctxMenu(0)
{}
-
+
~OPopupMenuPrivate ()
{
delete m_ctxMenu;
}
QString m_lastTitle;
// variables for keyboard navigation
QTimer clearTimer;
bool noMatches : 1;
bool shortcuts : 1;
@@ -169,25 +169,25 @@ OPopupMenu::OPopupMenu(QWidget *parent, const char *name)
d = new OPopupMenuPrivate;
resetKeyboardVars();
connect(&(d->clearTimer), SIGNAL(timeout()), SLOT(resetKeyboardVars()));
}
OPopupMenu::~OPopupMenu()
{
if (OPopupMenuPrivate::s_contextedMenu == this)
{
OPopupMenuPrivate::s_contextedMenu = 0;
OPopupMenuPrivate::s_highlightedItem = -1;
}
-
+
delete d;
}
int OPopupMenu::insertTitle(const QString &text, int id, int index)
{
OPopupTitle *titleItem = new OPopupTitle();
titleItem->setTitle(text);
int ret = insertItem(titleItem, id, index);
setItemEnabled(id, false);
return ret;
}
@@ -200,77 +200,77 @@ int OPopupMenu::insertTitle(const QPixmap &icon, const QString &text, int id,
setItemEnabled(id, false);
return ret;
}
void OPopupMenu::changeTitle(int id, const QString &text)
{
QMenuItem *item = findItem(id);
if(item){
if(item->widget())
((OPopupTitle *)item->widget())->setTitle(text);
#ifndef NDEBUG
else
- qWarning( "KPopupMenu: changeTitle() called with non-title id %d", id );
+ owarn << "KPopupMenu: changeTitle() called with non-title id " << id << "" << oendl;
#endif
}
#ifndef NDEBUG
else
- qWarning( "KPopupMenu: changeTitle() called with invalid id %d", id );
+ owarn << "KPopupMenu: changeTitle() called with invalid id " << id << "" << oendl;
#endif
}
void OPopupMenu::changeTitle(int id, const QPixmap &icon, const QString &text)
{
QMenuItem *item = findItem(id);
if(item){
if(item->widget())
((OPopupTitle *)item->widget())->setTitle(text, &icon);
#ifndef NDEBUG
else
- qWarning( "KPopupMenu: changeTitle() called with non-title id %d", id );
+ owarn << "KPopupMenu: changeTitle() called with non-title id " << id << "" << oendl;
#endif
}
#ifndef NDEBUG
else
- qWarning( "KPopupMenu: changeTitle() called with invalid id %d", id );
+ owarn << "KPopupMenu: changeTitle() called with invalid id " << id << "" << oendl;
#endif
}
QString OPopupMenu::title(int id) const
{
if(id == -1) // obsolete
return(d->m_lastTitle);
QMenuItem *item = findItem(id);
if(item){
if(item->widget())
return(((OPopupTitle *)item->widget())->title());
else
- qWarning("OPopupMenu: title() called with non-title id %d.", id);
+ owarn << "OPopupMenu: title() called with non-title id " << id << "." << oendl;
}
else
- qWarning("OPopupMenu: title() called with invalid id %d.", id);
+ owarn << "OPopupMenu: title() called with invalid id " << id << "." << oendl;
return(QString::null);
}
QPixmap OPopupMenu::titlePixmap(int id) const
{
QMenuItem *item = findItem(id);
if(item){
if(item->widget())
return(((OPopupTitle *)item->widget())->icon());
else
- qWarning("KPopupMenu: titlePixmap() called with non-title id %d.", id);
+ owarn << "KPopupMenu: titlePixmap() called with non-title id " << id << "." << oendl;
}
else
- qWarning("KPopupMenu: titlePixmap() called with invalid id %d.", id);
+ owarn << "KPopupMenu: titlePixmap() called with invalid id " << id << "." << oendl;
QPixmap tmp;
return(tmp);
}
/**
* This is re-implemented for keyboard navigation.
*/
void OPopupMenu::closeEvent(QCloseEvent*e)
{
if (d->shortcuts)
resetKeyboardVars();
QPopupMenu::closeEvent(e);