summaryrefslogtreecommitdiff
path: root/libopie2/qt3
authorar <ar>2005-01-21 20:19:00 (UTC)
committer ar <ar>2005-01-21 20:19:00 (UTC)
commit55eccecc08f839878e5743d6e6be25af386b5a3f (patch) (side-by-side diff)
treefd663ded2a2c097ce53bac6c021ca652ef5b5508 /libopie2/qt3
parentcd51d382be50bc021739395309e23760f1619759 (diff)
downloadopie-55eccecc08f839878e5743d6e6be25af386b5a3f.zip
opie-55eccecc08f839878e5743d6e6be25af386b5a3f.tar.gz
opie-55eccecc08f839878e5743d6e6be25af386b5a3f.tar.bz2
- make opie compilable against qte 2.3.10 snapshot
change QT_VERSION > 290 into QT_VERSION <= 0x030000
Diffstat (limited to 'libopie2/qt3') (more/less context) (show whitespace changes)
-rw-r--r--libopie2/qt3/opiecore/osortablevaluelist.h2
-rw-r--r--libopie2/qt3/opieui/ocombobox.cpp6
-rw-r--r--libopie2/qt3/opieui/oeditlistbox.cpp6
-rw-r--r--libopie2/qt3/opieui/olineedit.cpp6
4 files changed, 10 insertions, 10 deletions
diff --git a/libopie2/qt3/opiecore/osortablevaluelist.h b/libopie2/qt3/opiecore/osortablevaluelist.h
index f66cf25..a3f75b4 100644
--- a/libopie2/qt3/opiecore/osortablevaluelist.h
+++ b/libopie2/qt3/opiecore/osortablevaluelist.h
@@ -10,49 +10,49 @@
:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This program 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.
*/
#ifndef OSORTABLEVALUELIST_H
#define OSORTABLEVALUELIST_H
-#if QT_VERSION > 290
+#if QT_VERSION >= 0x030000
#include <qtl.h>
#include <qpair.h>
#else
#include <opie2/otl.h>
#include <opie2/opair.h>
#endif
#include <qvaluelist.h>
template<class T, class Key = int> class OSortableItem : public QPair<Key,T>
{
public:
OSortableItem( Key i, const T& t ) : QPair<Key, T>( i, t ) {}
OSortableItem( const OSortableItem<T, Key> &rhs )
: QPair<Key,T>( rhs.first, rhs.second ) {}
OSortableItem() {}
OSortableItem<T, Key> &operator=( const OSortableItem<T, Key>& i ) {
first = i.first;
second = i.second;
return *this;
}
// operators for sorting
diff --git a/libopie2/qt3/opieui/ocombobox.cpp b/libopie2/qt3/opieui/ocombobox.cpp
index bd330e0..130112c 100644
--- a/libopie2/qt3/opieui/ocombobox.cpp
+++ b/libopie2/qt3/opieui/ocombobox.cpp
@@ -297,96 +297,96 @@ void OComboBox::changeURL( const QPixmap& pixmap, const OURL& url, int index )
void OComboBox::setCompletedItems( const QStringList& items )
{
if ( d->olineEdit )
d->olineEdit->setCompletedItems( items );
}
OCompletionBox * OComboBox::completionBox( bool create )
{
if ( d->olineEdit )
return d->olineEdit->completionBox( create );
return 0;
}
// QWidget::create() turns off mouse-Tracking which would break auto-hiding
void OComboBox::create( WId id, bool initializeWindow, bool destroyOldWindow )
{
QComboBox::create( id, initializeWindow, destroyOldWindow );
//OCursor::setAutoHideCursor( lineEdit(), true, true );
}
void OComboBox::setLineEdit( OLineEdit *edit )
{
- #if QT_VERSION > 290
+ #if QT_VERSION >= 0x030000
QComboBox::setLineEdit( edit );
if ( !edit->inherits( "OLineEdit" ) )
d->olineEdit = 0;
else
d->olineEdit = static_cast<OLineEdit*>( edit );
setDelegate( d->olineEdit );
// forward some signals. We only emit returnPressed() ourselves.
if ( d->olineEdit ) {
connect( d->olineEdit, SIGNAL( completion(const QString&)),
SIGNAL( completion(const QString&)) );
connect( d->olineEdit, SIGNAL( substringCompletion(const QString&)),
SIGNAL( substringCompletion(const QString&)) );
connect( d->olineEdit,
SIGNAL( textRotation(OCompletionBase::KeyBindingType)),
SIGNAL( textRotation(OCompletionBase::KeyBindingType)) );
connect( d->olineEdit,
SIGNAL( completionModeChanged(OGlobalSettings::Completion)),
SIGNAL( completionModeChanged(OGlobalSettings::Completion)));
connect( d->olineEdit,
SIGNAL( aboutToShowContextMenu(QPopupMenu*)),
SIGNAL( aboutToShowContextMenu(QPopupMenu*)) );
}
#else
#warning OComboBox is not fully functional with Qt2
#endif
}
// Temporary functions until QT3 appears. - Seth Chaiklin 20 may 2001
void OComboBox::deleteWordForward()
{
lineEdit()->cursorWordForward(TRUE);
- #if QT_VERSION > 290
+ #if QT_VERSION >= 0x030000
if ( lineEdit()->hasSelectedText() )
#else
if ( lineEdit()->hasMarkedText() )
#endif
{
lineEdit()->del();
}
}
void OComboBox::deleteWordBack()
{
lineEdit()->cursorWordBackward(TRUE);
- #if QT_VERSION > 290
+ #if QT_VERSION >= 0x030000
if ( lineEdit()->hasSelectedText() )
#else
if ( lineEdit()->hasMarkedText() )
#endif
{
lineEdit()->del();
}
}
void OComboBox::setCurrentItem( const QString& item, bool insert, int index )
{
int sel = -1;
for (int i = 0; i < count(); ++i)
if (text(i) == item)
{
sel = i;
break;
}
if (sel == -1 && insert)
{
insertItem(item, index);
if (index >= 0)
sel = index;
else
diff --git a/libopie2/qt3/opieui/oeditlistbox.cpp b/libopie2/qt3/opieui/oeditlistbox.cpp
index 0e95274..dcc697d 100644
--- a/libopie2/qt3/opieui/oeditlistbox.cpp
+++ b/libopie2/qt3/opieui/oeditlistbox.cpp
@@ -171,49 +171,49 @@ void OEditListBox::typedSomething(const QString& text)
// IMHO changeItem() shouldn't do anything with the value
// of currentItem() ... like changing it or emitting signals ...
// but TT disagree with me on this one (it's been that way since ages ... grrr)
bool block = m_listBox->signalsBlocked();
m_listBox->blockSignals( true );
m_listBox->changeItem(text, currentItem());
m_listBox->blockSignals( block );
emit changed();
}
}
if ( !servNewButton )
return;
if (!d->m_checkAtEntering)
servNewButton->setEnabled(!text.isEmpty());
else
{
if (text.isEmpty())
{
servNewButton->setEnabled(false);
}
else
{
- #if QT_VERSION > 290
+ #if QT_VERSION >= 0x030000
StringComparisonMode mode = (StringComparisonMode) (ExactMatch | CaseSensitive );
bool enable = (m_listBox->findItem( text, mode ) == 0L);
#else
bool enable = (m_listBox->findItem( text ) == 0L);
#endif
servNewButton->setEnabled( enable );
}
}
}
void OEditListBox::moveItemUp()
{
if (!m_listBox->isEnabled())
{
//ONotifyClient::beep();
return;
}
unsigned int selIndex = m_listBox->currentItem();
if (selIndex == 0)
{
//ONotifyClient::beep();
return;
}
@@ -246,82 +246,82 @@ void OEditListBox::moveItemDown()
m_listBox->insertItem(selItem, selIndex+1);
m_listBox->setCurrentItem(selIndex + 1);
emit changed();
}
void OEditListBox::addItem()
{
// when m_checkAtEntering is true, the add-button is disabled, but this
// slot can still be called through Key_Return/Key_Enter. So we guard
// against this.
if ( !servNewButton || !servNewButton->isEnabled() )
return;
const QString& currentTextLE=m_lineEdit->text();
bool alreadyInList(false);
//if we didn't check for dupes at the inserting we have to do it now
if (!d->m_checkAtEntering)
{
// first check current item instead of dumb iterating the entire list
if ( m_listBox->currentText() == currentTextLE )
alreadyInList = true;
else
{
- #if QT_VERSION > 290
+ #if QT_VERSION >= 0x030000
StringComparisonMode mode = (StringComparisonMode) (ExactMatch | CaseSensitive );
alreadyInList =(m_listBox->findItem(currentTextLE, mode) != 0);
#else
alreadyInList =(m_listBox->findItem(currentTextLE) != 0);
#endif
}
}
if ( servNewButton )
servNewButton->setEnabled(false);
bool block = m_lineEdit->signalsBlocked();
m_lineEdit->blockSignals(true);
m_lineEdit->clear();
m_lineEdit->blockSignals(block);
m_listBox->setSelected(currentItem(), false);
if (!alreadyInList)
{
block = m_listBox->signalsBlocked();
m_listBox->blockSignals( true );
m_listBox->insertItem(currentTextLE);
m_listBox->blockSignals( block );
emit changed();
emit added( currentTextLE );
}
}
int OEditListBox::currentItem() const
{
int nr = m_listBox->currentItem();
- #if QT_VERSION > 290
+ #if QT_VERSION >= 0x030000
if(nr >= 0 && !m_listBox->item(nr)->isSelected()) return -1;
#else
if(nr >= 0 && !m_listBox->isSelected(m_listBox->item(nr))) return -1;
#endif
return nr;
}
void OEditListBox::removeItem()
{
int selected = m_listBox->currentItem();
if ( selected >= 0 )
{
QString removedText = m_listBox->currentText();
m_listBox->removeItem( selected );
if ( count() > 0 )
m_listBox->setSelected( QMIN( selected, count() - 1 ), true );
emit changed();
emit removed( removedText );
}
if ( servRemoveButton && m_listBox->currentItem() == -1 )
diff --git a/libopie2/qt3/opieui/olineedit.cpp b/libopie2/qt3/opieui/olineedit.cpp
index 6f66fc7..b150987 100644
--- a/libopie2/qt3/opieui/olineedit.cpp
+++ b/libopie2/qt3/opieui/olineedit.cpp
@@ -124,49 +124,49 @@ void OLineEdit::setCompletedText( const QString& t, bool marked )
validateAndSet( t, curpos, curpos, t.length() );
}
}
void OLineEdit::setCompletedText( const QString& text )
{
OGlobalSettings::Completion mode = completionMode();
bool marked = ( mode == OGlobalSettings::CompletionAuto ||
mode == OGlobalSettings::CompletionMan ||
mode == OGlobalSettings::CompletionPopup );
setCompletedText( text, marked );
}
void OLineEdit::rotateText( OCompletionBase::KeyBindingType type )
{
OCompletion* comp = compObj();
if ( comp &&
(type == OCompletionBase::PrevCompletionMatch ||
type == OCompletionBase::NextCompletionMatch ) )
{
QString input = (type == OCompletionBase::PrevCompletionMatch) ? comp->previousMatch() : comp->nextMatch();
// Skip rotation if previous/next match is null or the same text
if ( input.isNull() || input == displayText() )
return;
- #if QT_VERSION > 290
+ #if QT_VERSION >= 0x030000
setCompletedText( input, hasSelectedText() );
#else
setCompletedText( input, hasMarkedText() );
#endif
}
}
void OLineEdit::makeCompletion( const QString& text )
{
OCompletion *comp = compObj();
if ( !comp )
return; // No completion object...
QString match = comp->makeCompletion( text );
OGlobalSettings::Completion mode = completionMode();
if ( mode == OGlobalSettings::CompletionPopup )
{
if ( match.isNull() )
{
if ( d->completionBox ) {
d->completionBox->hide();
d->completionBox->clear();
}
}
@@ -250,49 +250,49 @@ void OLineEdit::keyPressEvent( QKeyEvent *e )
e->accept();
return;
}
*/
// Filter key-events if EchoMode is normal &
// completion mode is not set to CompletionNone
if ( echoMode() == QLineEdit::Normal &&
completionMode() != OGlobalSettings::CompletionNone )
{
KeyBindingMap keys = getKeyBindings();
OGlobalSettings::Completion mode = completionMode();
bool noModifier = (e->state() == NoButton || e->state()== ShiftButton);
if ( (mode == OGlobalSettings::CompletionAuto ||
mode == OGlobalSettings::CompletionMan) && noModifier )
{
QString keycode = e->text();
if ( !keycode.isNull() && keycode.unicode()->isPrint() )
{
QLineEdit::keyPressEvent ( e );
QString txt = text();
int len = txt.length();
- #if QT_VERSION > 290
+ #if QT_VERSION >= 0x030000
if ( !hasSelectedText() && len && cursorPosition() == len )
#else
if ( !hasMarkedText() && len && cursorPosition() == len )
#endif
{
if ( emitSignals() )
emit completion( txt );
if ( handleSignals() )
makeCompletion( txt );
e->accept();
}
return;
}
}
else if ( mode == OGlobalSettings::CompletionPopup && noModifier )
{
qDebug( "OLineEdit::keyPressEvent() - global settings = CompletionPopup & noModifier" );
QString old_txt = text();
QLineEdit::keyPressEvent ( e );
QString txt = text();
int len = txt.length();
QString keycode = e->text();
@@ -415,49 +415,49 @@ void OLineEdit::mouseDoubleClickEvent( QMouseEvent* e )
QLineEdit::mouseDoubleClickEvent( e );
}
void OLineEdit::mousePressEvent( QMouseEvent* e )
{
if ( possibleTripleClick && e->button() == Qt::LeftButton )
{
selectAll();
return;
}
QLineEdit::mousePressEvent( e );
}
void OLineEdit::tripleClickTimeout()
{
possibleTripleClick=false;
}
QPopupMenu *OLineEdit::createPopupMenu()
{
// Return if popup menu is not enabled !!
if ( !m_bEnableMenu )
return 0;
- #if QT_VERSION > 290
+ #if QT_VERSION >= 0x030000
QPopupMenu *popup = QLineEdit::createPopupMenu();
#else
QPopupMenu *popup = new QPopupMenu();
#warning OLineEdit is not fully functional on Qt2
#endif
// completion object is present.
if ( compObj() )
{
QPopupMenu *subMenu = new QPopupMenu( popup );
connect( subMenu, SIGNAL( activated(int) ),
this, SLOT( completionMenuActivated(int) ) );
popup->insertSeparator();
//popup->insertItem( SmallIconSet("completion"), i18n("Text Completion"),
// subMenu );
popup->insertItem( tr("Text Completion"), subMenu );
subMenu->insertItem( tr("None"), NoCompletion );
subMenu->insertItem( tr("Manual"), ShellCompletion );
subMenu->insertItem( tr("Automatic"), AutoCompletion );
subMenu->insertItem( tr("Dropdown List"), PopupCompletion );
subMenu->insertItem( tr("Short Automatic"), SemiAutoCompletion );