-rw-r--r-- | microkde/kconfig.cpp | 4 | ||||
-rw-r--r-- | microkde/kdecore/kstandarddirs.cpp | 2 | ||||
-rw-r--r-- | microkde/kdeui/kactioncollection.cpp | 5 | ||||
-rw-r--r-- | microkde/kdeui/klistview.cpp | 2 |
4 files changed, 7 insertions, 6 deletions
diff --git a/microkde/kconfig.cpp b/microkde/kconfig.cpp index ba41f6c..5b685d3 100644 --- a/microkde/kconfig.cpp +++ b/microkde/kconfig.cpp @@ -176,194 +176,194 @@ QFont KConfig::readFontEntry( const QString & e, QFont *def ) f.setPointSize ( font[2].toInt()); f.setItalic( font[3] == "italic" ); return f; } QDateTime KConfig::readDateTimeEntry( const QString &key, const QDateTime *def ) { QMap<QString,QDateTime>::ConstIterator it = mDateTimeMap.find( mGroup + key ); if ( it == mDateTimeMap.end() ) { if ( def ) return *def; else return QDateTime(); } return *it; } //US added method void KConfig::writeEntry( const QString &key, const QValueList<int> &value) { QStringList valuesAsStrings; QValueList<int>::ConstIterator it; for( it = value.begin(); it != value.end(); ++it ) { valuesAsStrings << QString::number(*it); } mStringMap.insert( mGroup + key, valuesAsStrings.join(":") ); mDirty = true; } void KConfig::writeEntry( const QString & key , int num ) { writeEntry( key, QString::number ( num ) ); } void KConfig::writeEntry( const QString &key, const QString &value ) { mStringMap.insert( mGroup + key, value ); mDirty = true; } void KConfig::writeEntry( const QString &key, const QStringList &value ) { mStringMap.insert( mGroup + key, value.join(":") ); mDirty = true; } void KConfig::writeEntry( const QString &key, bool value) { mBoolMap.insert( mGroup + key, value ); mDirty = true; } void KConfig::writeEntry( const QString & e, const QColor & c ) { QStringList l; l.append( QString::number ( c.red() ) ); l.append( QString::number ( c.green() ) ); l.append( QString::number ( c.blue() ) ); writeEntry( e, l ); } void KConfig::writeEntry( const QString & e, const QSize & s ) { QValueList<int> intlist; intlist << s.width() << s.height(); writeEntry( e, intlist ); } void KConfig::writeEntry( const QString & e , const QFont & f ) { QStringList font; font.append( f.family()); font.append( (!f.bold ()?"nonbold":"bold") ); font.append( QString::number ( f.pointSize () ) ); font.append( !f.italic ()?"nonitalic":"italic" ); writeEntry( e, font ); } void KConfig::writeEntry( const QString &key, const QDateTime &dt ) { mDateTimeMap.insert( mGroup + key, dt ); } void KConfig::load() { QFile f( mFileName ); if ( !f.open( IO_ReadOnly ) ) { - qDebug("KConfig: could not open file %s ",mFileName.latin1() ); - return; + //qDebug("KConfig: could not open file %s ",mFileName.latin1() ); + return; } mBoolMap.clear(); mStringMap.clear(); QTextStream t( &f ); QString line = t.readLine(); while ( !line.isNull() ) { QStringList tokens = QStringList::split( ",", line ); if ( tokens[0] == "bool" ) { bool value = false; if ( tokens[2] == "1" ) value = true; mBoolMap.insert( tokens[1], value ); } else if ( tokens[0] == "QString" ) { QString value = tokens[2]; mStringMap.insert( tokens[1], value ); } else if ( tokens[0] == "QDateTime" ) { #if 0 int year = tokens[2].toInt(); QDateTime dt( QDate( year, tokens[3].toInt(), tokens[4].toInt() ), QTime( tokens[5].toInt(), tokens[6].toInt(), tokens[7].toInt() ) ); mDateTimeMap.insert( tokens[1], dt ); #endif } line = t.readLine(); } } void KConfig::sync() { if ( !mDirty ) return; //qDebug("KConfig::sync() %s ",mFileName.latin1() ); //kdDebug() << "KConfig::sync(): " << mFileName << endl; //US I took the following code from a newer version of KDE // Create the containing dir if needed KURL path; path.setPath(mFileName); QString dir=path.directory(); KStandardDirs::makeDir(dir); QFile f( mFileName ); if ( !f.open( IO_WriteOnly ) ) { qDebug("KConfig::sync() Can't open file %s ",mFileName.latin1() ); return; } QTextStream t( &f ); QMap<QString,bool>::ConstIterator itBool; for( itBool = mBoolMap.begin(); itBool != mBoolMap.end(); ++itBool ) { t << "bool," << itBool.key() << "," << ( *itBool ? "1" : "0" ) << endl; } QMap<QString,QString>::ConstIterator itString; for( itString = mStringMap.begin(); itString != mStringMap.end(); ++itString ) { t << "QString," << itString.key() << "," << (*itString ) << endl; } QMap<QString,QDateTime>::ConstIterator itDateTime; for( itDateTime = mDateTimeMap.begin(); itDateTime != mDateTimeMap.end(); ++itDateTime ) { QDateTime dt = *itDateTime; t << "QDateTime," << itDateTime.key() << "," << dt.date().year() << "," << dt.date().month() << "," << dt.date().day() << "," << dt.time().hour() << "," << dt.time().minute() << "," << dt.time().second() << endl; } f.close(); mDirty = false; } //US I took the following deleteGroup method from a newer version from KDE. /** * Deletes a configuration entry group * * If the group is not empty and bDeep is false, nothing gets * deleted and false is returned. * If this group is the current group and it is deleted, the * current group is undefined and should be set with setGroup() * before the next operation on the configuration object. * diff --git a/microkde/kdecore/kstandarddirs.cpp b/microkde/kdecore/kstandarddirs.cpp index 1c3e0ae..4c03c15 100644 --- a/microkde/kdecore/kstandarddirs.cpp +++ b/microkde/kdecore/kstandarddirs.cpp @@ -1463,193 +1463,193 @@ bool KStandardDirs::addCustomized(KConfig *config) addPrefix(*it); // iterating over all entries in the group Directories // to find entries that start with dir_$type /*US QMap<QString, QString> entries = config->entryMap("Directories"); QMap<QString, QString>::ConstIterator it2; for (it2 = entries.begin(); it2 != entries.end(); it2++) { QString key = it2.key(); if (key.left(4) == "dir_") { // generate directory list, there may be more than 1. QStringList dirs = QStringList::split(',', *it2); QStringList::Iterator sIt(dirs.begin()); QString resType = key.mid(4, key.length()); for (; sIt != dirs.end(); ++sIt) { addResourceDir(resType.latin1(), *sIt); } } } // Process KIOSK restrictions. config->setGroup("KDE Resource Restrictions"); entries = config->entryMap("KDE Resource Restrictions"); for (it2 = entries.begin(); it2 != entries.end(); it2++) { QString key = it2.key(); if (!config->readBoolEntry(key, true)) { d->restrictionsActive = true; d->restrictions.insert(key.latin1(), &d->restrictionsActive); // Anything will do dircache.remove(key.latin1()); } } */ // save it for future calls - that will return addedCustoms = true; config->setGroup(oldGroup); // return true if the number of config dirs changed return (resourceDirs("config").count() != configdirs); } QString KStandardDirs::localkdedir() const { // Return the prefix to use for saving return prefixes.first(); } QString KStandardDirs::localxdgdatadir() const { // Return the prefix to use for saving return d->xdgdata_prefixes.first(); } QString KStandardDirs::localxdgconfdir() const { // Return the prefix to use for saving return d->xdgconf_prefixes.first(); } void KStandardDirs::setAppDir( const QString &appDir ) { mAppDir = appDir; if ( mAppDir.right( 1 ) != "/" ) mAppDir += "/"; } QString KStandardDirs::appDir() { return mAppDir; } // just to make code more readable without macros QString locate( const char *type, const QString& filename/*US , const KInstance* inst*/ ) { //US return inst->dirs()->findResource(type, filename); return KGlobal::dirs()->findResource(type, filename); } QString locateLocal( const char *type, const QString& filename/*US , const KInstance* inst*/ ) { QString path = locateLocal(type, filename, true /*US, inst*/); /* static int ccc = 0; ++ccc; if ( ccc > 13 ) abort(); */ - qDebug("locatelocal: %s" , path.latin1()); + //qDebug("locatelocal: %s" , path.latin1()); return path; /*US why do we put all files into one directory. It is quit complicated. why not staying with the original directorystructure ? QString escapedFilename = filename; escapedFilename.replace( QRegExp( "/" ), "_" ); QString path = KStandardDirs::appDir() + type + "_" + escapedFilename; kdDebug() << "locate: '" << path << "'" << endl; qDebug("locate: %s" , path.latin1()); return path; */ //US so my proposal is this: // QString escapedFilename = filename; // escapedFilename.replace( QRegExp( "/" ), "_" ); #if 0 #ifdef _WIN32_ QString path = QDir::convertSeparators(KStandardDirs::appDir() + type + "/" + filename); #else QString path = KStandardDirs::appDir() + type + "/" + filename; #endif //US Create the containing dir if needed QFileInfo fi ( path ); // QString dir=pathurl.directory(); // QMessageBox::information( 0,"path", path, 1 ); #ifdef _WIN32_ KStandardDirs::makeDir(path); #else KStandardDirs::makeDir(fi.dirPath( true )); #endif qDebug("locate22: %s" , path.latin1()); return path; #endif } QString locateLocal( const char *type, const QString& filename, bool createDir/*US , const KInstance* inst*/ ) { // try to find slashes. If there are some, we have to // create the subdir first int slash = filename.findRev('/')+1; if (!slash) // only one filename //US return inst->dirs()->saveLocation(type, QString::null, createDir) + filename; return KGlobal::dirs()->saveLocation(type, QString::null, createDir) + filename; // split path from filename QString dir = filename.left(slash); QString file = filename.mid(slash); //US return inst->dirs()->saveLocation(type, dir, createDir) + file; return KGlobal::dirs()->saveLocation(type, dir, createDir) + file; // *************************************************************** #if 0 /*US why do we put all files into one directory. It is quit complicated. why not staying with the original directorystructure ? QString escapedFilename = filename; escapedFilename.replace( QRegExp( "/" ), "_" ); QString path = KStandardDirs::appDir() + type + "_" + escapedFilename; kdDebug() << "locate: '" << path << "'" << endl; qDebug("locate: %s" , path.latin1()); return path; */ //US so my proposal is this: // QString escapedFilename = filename; // escapedFilename.replace( QRegExp( "/" ), "_" ); #ifdef _WIN32_ QString path = QDir::convertSeparators(KStandardDirs::appDir() + type + "/" + filename); #else QString path = KStandardDirs::appDir() + type + "/" + filename; #endif //US Create the containing dir if needed KURL pathurl; pathurl.setPath(path); QString dir=pathurl.directory(); // QMessageBox::information( 0,"path", path, 1 ); #ifdef _WIN32_ KStandardDirs::makeDir(path); diff --git a/microkde/kdeui/kactioncollection.cpp b/microkde/kdeui/kactioncollection.cpp index b819e76..69e5d02 100644 --- a/microkde/kdeui/kactioncollection.cpp +++ b/microkde/kdeui/kactioncollection.cpp @@ -60,197 +60,198 @@ public: m_statusCleared = true; } //US KInstance *m_instance; //US QString m_sXMLFile; bool m_bAutoConnectShortcuts; //bool m_bOneKAccelOnly; //int m_iWidgetCurrent; //QValueList<QWidget*> m_widgetList; //QValueList<KAccel*> m_kaccelList; QValueList<KActionCollection*> m_docList; QWidget *m_widget; KAccel *m_kaccel; KAccel *m_builderKAccel; QAsciiDict<KAction> m_actionDict; QPtrDict< QPtrList<KAction> > m_dctHighlightContainers; bool m_highlight; KAction *m_currentHighlightAction; bool m_statusCleared; }; KActionCollection::KActionCollection( QWidget *parent, const char *name /*US, KInstance *instance */) : QObject( (QObject*)parent, name ) { kdDebug(129) << "KActionCollection::KActionCollection( " << parent << ", " << name << " ): this = " << this << endl; // ellis d = new KActionCollectionPrivate; if( parent ) setWidget( parent ); //d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0); //US setInstance( instance ); } KActionCollection::KActionCollection( QWidget *watch, QObject* parent, const char *name /*US, KInstance *instance */) : QObject( parent, name ) { kdDebug(129) << "KActionCollection::KActionCollection( " << watch << ", " << parent << ", " << name << " ): this = " << this << endl; //ellis d = new KActionCollectionPrivate; if( watch ) setWidget( watch ); //d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0); //US setInstance( instance ); } // KDE 4: remove KActionCollection::KActionCollection( QObject *parent, const char *name /*US, KInstance *instance */) : QObject( parent, name ) { kdWarning(129) << "KActionCollection::KActionCollection( QObject *parent, const char *name, KInstance *instance )" << endl; //ellis //US kdBacktrace not available //US kdDebug(129) << kdBacktrace() << endl; d = new KActionCollectionPrivate; //US QWidget* w = dynamic_cast<QWidget*>( parent ); QWidget* w = (QWidget*)( parent ); if( w ) setWidget( w ); //d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0); //US setInstance( instance ); } KActionCollection::KActionCollection( const KActionCollection © ) : QObject() { kdWarning(129) << "KActionCollection::KActionCollection( const KActionCollection & ): function is severely deprecated." << endl; d = new KActionCollectionPrivate; *this = copy; } // KDE 4: remove end KActionCollection::~KActionCollection() { kdDebug(129) << "KActionCollection::~KActionCollection(): this = " << this << endl; for ( QAsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) { KAction* pAction = it.current(); if ( pAction->m_parentCollection == this ) pAction->m_parentCollection = 0L; } //US delete d->m_kaccel; //US delete d->m_builderKAccel; delete d; d = 0; } void KActionCollection::setWidget( QWidget* w ) { //if ( d->m_actionDict.count() > 0 ) { // kdError(129) << "KActionCollection::setWidget(): must be called before any actions are added to collection!" << endl; // kdDebug(129) << kdBacktrace() << endl; //} //else if ( !d->m_widget ) { d->m_widget = w; - qDebug("KActionCollection::setWidget: warning: KAccel is never used in microkde"); + //qDebug("KActionCollection::setWidget: warning: KAccel is never used in microkde"); //US d->m_kaccel = new KAccel( w, this, "KActionCollection-KAccel" ); } else if ( d->m_widget != w ) - kdWarning(129) << "KActionCollection::setWidget(): tried to change widget from " << d->m_widget << " to " << w << endl; + ; + } void KActionCollection::setAutoConnectShortcuts( bool b ) { d->m_bAutoConnectShortcuts = b; } bool KActionCollection::isAutoConnectShortcuts() { return d->m_bAutoConnectShortcuts; } bool KActionCollection::addDocCollection( KActionCollection* pDoc ) { d->m_docList.append( pDoc ); return true; } void KActionCollection::beginXMLPlug( QWidget *widget ) { qDebug("KActionCollection::beginXMLPlug has to be fixed"); /*US kdDebug(129) << "KActionCollection::beginXMLPlug( buildWidget = " << widget << " ): this = " << this << " d->m_builderKAccel = " << d->m_builderKAccel << endl; if( widget && !d->m_builderKAccel ) { d->m_builderKAccel = new KAccel( widget, this, "KActionCollection-BuilderKAccel" ); } */ } void KActionCollection::endXMLPlug() { kdDebug(129) << "KActionCollection::endXMLPlug(): this = " << this << endl; //s_kaccelXML = 0; } void KActionCollection::prepareXMLUnplug() { qDebug("KActionCollection::prepareXMLUnplug has to be fixed"); /*US kdDebug(129) << "KActionCollection::prepareXMLUnplug(): this = " << this << endl; unplugShortcuts( d->m_kaccel ); if( d->m_builderKAccel ) { unplugShortcuts( d->m_builderKAccel ); delete d->m_builderKAccel; d->m_builderKAccel = 0; } */ } void KActionCollection::unplugShortcuts( KAccel* kaccel ) { qDebug("KActionCollection::unplugShortcuts has to be fixed"); /*US for ( QAsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) { KAction* pAction = it.current(); pAction->removeKAccel( kaccel ); } for( uint i = 0; i < d->m_docList.count(); i++ ) d->m_docList[i]->unplugShortcuts( kaccel ); */ } /*void KActionCollection::addWidget( QWidget* w ) { if( !d->m_bOneKAccelOnly ) { kdDebug(129) << "KActionCollection::addWidget( " << w << " ): this = " << this << endl; for( uint i = 0; i < d->m_widgetList.count(); i++ ) { if( d->m_widgetList[i] == w ) { d->m_iWidgetCurrent = i; return; } } d->m_iWidgetCurrent = d->m_widgetList.count(); d->m_widgetList.append( w ); d->m_kaccelList.append( new KAccel( w, this, "KActionCollection-KAccel" ) ); } } void KActionCollection::removeWidget( QWidget* w ) { if( !d->m_bOneKAccelOnly ) { kdDebug(129) << "KActionCollection::removeWidget( " << w << " ): this = " << this << endl; for( uint i = 0; i < d->m_widgetList.count(); i++ ) { if( d->m_widgetList[i] == w ) { // Remove KAccel object from children. KAccel* pKAccel = d->m_kaccelList[i]; for ( QAsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) { KAction* pAction = it.current(); if ( pAction->m_parentCollection == this ) { pAction->removeKAccel( pKAccel ); } } diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp index b53a88a..2856f2d 100644 --- a/microkde/kdeui/klistview.cpp +++ b/microkde/kdeui/klistview.cpp @@ -422,193 +422,193 @@ KListView::KListView( QWidget *parent, const char *name ) connect (this, SIGNAL(contentsMoving(int,int)), this, SLOT(cleanDropVisualizer())); connect (this, SIGNAL(contentsMoving(int,int)), this, SLOT(cleanItemHighlighter())); /*US slotSettingsChanged(KApplication::SETTINGS_MOUSE); if (kapp) { connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) ); kapp->addKipcEventMask( KIPC::SettingsChanged ); } */ slotSettingsChanged(1); //US do this to initialize the connections connect(&d->autoSelect, SIGNAL( timeout() ), this, SLOT( slotAutoSelect() ) ); connect(&d->dragExpand, SIGNAL( timeout() ), this, SLOT( slotDragExpand() ) ); // context menu handling if (d->showContextMenusOnPress) { connect (this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); } else { connect (this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); } connect (this, SIGNAL (menuShortCutPressed (KListView*, QListViewItem*)), this, SLOT (emitContextMenu (KListView*, QListViewItem*))); //qDebug("KListView::KListView make alternate color configurable"); //US d->alternateBackground = KGlobalSettings::alternateBackgroundColor(); d->alternateBackground = QColor(240, 240, 240); } KListView::~KListView() { delete d; } bool KListView::isExecuteArea( const QPoint& point ) { if ( itemAt( point ) ) return isExecuteArea( point.x() ); return false; } bool KListView::isExecuteArea( int x ) { if( allColumnsShowFocus() ) return true; else { int offset = 0; int width = columnWidth( 0 ); int pos = header()->mapToIndex( 0 ); for ( int index = 0; index < pos; index++ ) offset += columnWidth( header()->mapToSection( index ) ); x += contentsX(); // in case of a horizontal scrollbar return ( x > offset && x < ( offset + width ) ); } } void KListView::slotOnItem( QListViewItem *item ) { QPoint vp = viewport()->mapFromGlobal( QCursor::pos() ); if ( item && isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) { d->autoSelect.start( d->autoSelectDelay, true ); d->pCurrentItem = item; } } void KListView::slotOnViewport() { if ( d->bChangeCursorOverItem ) viewport()->unsetCursor(); d->autoSelect.stop(); d->pCurrentItem = 0L; } void KListView::slotSettingsChanged(int category) { -qDebug("KListView::slotSettingsChanged has to be verified"); + //qDebug("KListView::slotSettingsChanged has to be verified"); /*US switch (category) { case KApplication::SETTINGS_MOUSE: d->dragDelay = KGlobalSettings::dndEventDelay(); d->bUseSingle = KGlobalSettings::singleClick(); disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); if( d->bUseSingle ) connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); if( !d->bUseSingle || !d->bChangeCursorOverItem ) viewport()->unsetCursor(); break; case KApplication::SETTINGS_POPUPMENU: d->contextMenuKey = KGlobalSettings::contextMenuKey (); d->showContextMenusOnPress = KGlobalSettings::showContextMenusOnPress (); if (d->showContextMenusOnPress) { disconnect (0L, 0L, this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); connect(this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); } else { disconnect (0L, 0L, this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); connect(this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); } break; default: break; } */ if( d->bUseSingle ) connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); } void KListView::slotAutoSelect() { // check that the item still exists if( itemIndex( d->pCurrentItem ) == -1 ) return; if (!isActiveWindow()) { d->autoSelect.stop(); return; } //Give this widget the keyboard focus. if( !hasFocus() ) setFocus(); QListViewItem* previousItem = currentItem(); setCurrentItem( d->pCurrentItem ); #if 0 #ifndef Q_WS_QWS // FIXME(E): Implement for Qt Embedded if( d->pCurrentItem ) { //Shift pressed? if( (keybstate & ShiftMask) ) { bool block = signalsBlocked(); blockSignals( true ); //No Ctrl? Then clear before! if( !(keybstate & ControlMask) ) clearSelection(); bool select = !d->pCurrentItem->isSelected(); bool update = viewport()->isUpdatesEnabled(); viewport()->setUpdatesEnabled( false ); bool down = previousItem->itemPos() < d->pCurrentItem->itemPos(); QListViewItemIterator lit( down ? previousItem : d->pCurrentItem ); for ( ; lit.current(); ++lit ) { if ( down && lit.current() == d->pCurrentItem ) { d->pCurrentItem->setSelected( select ); break; |