";
qerror += "" + i18n("Unfortunately, the device %1 (%2) named '%3' and "
@@ -1312,6 +1632,7 @@ QString HALBackend::unmount(const QString &_udi)
qerror += "
" + i18n("Unmounting failed due to the following error:") + "
";
if (!strcmp(error.name, "org.freedesktop.Hal.Device.Volume.Busy")) {
reason = i18n("Device is Busy:");
+ thisunmounthasfailed = 2;
} else if (!strcmp(error.name, "org.freedesktop.Hal.Device.Volume.NotMounted")) {
// this is faking. The error is that the device wasn't mounted by hal (but by the system)
reason = i18n("Permissions denied");
@@ -1319,16 +1640,29 @@ QString HALBackend::unmount(const QString &_udi)
reason = error.message;
}
qerror += "" + reason + "
";
+ origqerror = qerror;
// Include list of processes (if any) using the device in the error message
reason = listUsingProcesses(medium);
if (!reason.isEmpty()) {
qerror += reason;
+ if (thisunmounthasfailed == 2) { // Failed as BUSY
+ if (KMessageBox::warningYesNo(0, i18n("%1Would you like to forcibly terminate these processes?
All unsaved data would be lost").arg(qerror)) == KMessageBox::Yes) {
+ qerror = origqerror;
+ reason = killUsingProcesses(medium);
+ qerror = HALBackend::unmount(udi);
+ if (qerror.isNull()) {
+ thisunmounthasfailed = 0;
+ }
+ }
+ }
}
- dbus_message_unref (dmesg);
- dbus_error_free (&error);
- return qerror;
+ if (thisunmounthasfailed != 0) {
+ dbus_message_unref (dmesg);
+ dbus_error_free (&error);
+ return qerror;
+ }
}
kdDebug() << "unmount queued for " << udi << endl;
@@ -1337,8 +1671,117 @@ QString HALBackend::unmount(const QString &_udi)
dbus_message_unref (reply);
medium->setHalMounted(false);
+ ResetProperties(medium->id().latin1());
+
+ while (dbus_connection_dispatch(dbus_connection) == DBUS_DISPATCH_DATA_REMAINS) ;
+
+ return QString();
+}
+
+QString HALBackend::decrypt(const QString &_udi, const QString &password)
+{
+ const Medium* medium = m_mediaList.findById(_udi);
+ if (!medium)
+ return i18n("No such medium: %1").arg(_udi);
+
+ if (!medium->isEncrypted() || !medium->clearDeviceUdi().isNull())
+ return QString();
+
+ const char *udi = medium->id().latin1();
+ DBusMessage *msg = NULL;
+ DBusMessage *reply = NULL;
+ DBusError error;
+
+ kdDebug() << "Setting up " << udi << " for crypto\n" <isEncrypted() || medium->clearDeviceUdi().isNull())
+ return QString();
+
+ const char *udi = medium->id().latin1();
+ DBusMessage *msg = NULL;
+ DBusMessage *reply = NULL;
+ DBusError error;
+
+ kdDebug() << "Tear down " << udi << "\n" <clearDeviceUdi() == name) return medium;
+ }
+
+ return 0L;
+}
+
QString MediaList::addMedium(Medium *medium, bool allowNotification)
{
@@ -121,11 +133,12 @@ bool MediaList::changeMediumState(const Medium &medium, bool allowNotification)
if ( medium.isMountable() )
{
QString device_node = medium.deviceNode();
+ QString clear_device_udi = medium.clearDeviceUdi();
QString mount_point = medium.mountPoint();
QString fs_type = medium.fsType();
bool mounted = medium.isMounted();
- m->mountableState( device_node, mount_point,
+ m->mountableState( device_node, clear_device_udi, mount_point,
fs_type, mounted );
}
else
diff --git a/kioslave/media/mediamanager/medialist.h b/kioslave/media/mediamanager/medialist.h
index 590491b0c..4de333875 100644
--- a/kioslave/media/mediamanager/medialist.h
+++ b/kioslave/media/mediamanager/medialist.h
@@ -34,6 +34,7 @@ public:
const QPtrList list() const;
const Medium *findById(const QString &id) const;
const Medium *findByName(const QString &name) const;
+ const Medium *findByClearUdi(const QString &name);
public:
QString addMedium(Medium *medium, bool allowNotification = true);
diff --git a/kioslave/media/mediamanager/mediamanager.cpp b/kioslave/media/mediamanager/mediamanager.cpp
index ad8f1b447..f1569e817 100644
--- a/kioslave/media/mediamanager/mediamanager.cpp
+++ b/kioslave/media/mediamanager/mediamanager.cpp
@@ -232,6 +232,28 @@ QString MediaManager::unmount(const QString &name)
#endif
}
+QString MediaManager::decrypt(const QString &name, const QString &password)
+{
+#ifdef COMPILE_HALBACKEND
+ if (!m_halbackend)
+ return i18n("Feature only available with HAL");
+ return m_halbackend->decrypt(name, password);
+#else
+ return i18n("Feature only available with HAL");
+#endif
+}
+
+QString MediaManager::undecrypt(const QString &name)
+{
+#ifdef COMPILE_HALBACKEND
+ if (!m_halbackend)
+ return i18n("Feature only available with HAL");
+ return m_halbackend->undecrypt(name);
+#else
+ return i18n("Feature only available with HAL");
+#endif
+}
+
QString MediaManager::nameForLabel(const QString &label)
{
const QPtrList media = m_mediaList.list();
diff --git a/kioslave/media/mediamanager/mediamanager.h b/kioslave/media/mediamanager/mediamanager.h
index 1e5aa1d84..36942362d 100644
--- a/kioslave/media/mediamanager/mediamanager.h
+++ b/kioslave/media/mediamanager/mediamanager.h
@@ -47,6 +47,8 @@ k_dcop:
QString mount(const QString &uid);
QString unmount(const QString &uid);
+ QString decrypt(const QString &uid, const QString &password);
+ QString undecrypt(const QString &uid);
QString nameForLabel(const QString &label);
ASYNC setUserLabel(const QString &name, const QString &label);
diff --git a/kioslave/media/medianotifier/medianotifier.cpp b/kioslave/media/medianotifier/medianotifier.cpp
index 98a474ba7..ce39215d9 100644
--- a/kioslave/media/medianotifier/medianotifier.cpp
+++ b/kioslave/media/medianotifier/medianotifier.cpp
@@ -19,8 +19,12 @@
#include "medianotifier.h"
+#include
+
#include
#include
+#include
+#include
#include
#include
@@ -44,6 +48,11 @@ MediaNotifier::MediaNotifier(const QCString &name) : KDEDModule(name)
connectDCOPSignal( "kded", "mediamanager", "mediumChanged(QString, bool)",
"onMediumChange(QString, bool)", true );
+
+ m_freeTimer = new QTimer( this );
+ connect( m_freeTimer, SIGNAL( timeout() ), SLOT( checkFreeDiskSpace() ) );
+ m_freeTimer->start( 1000*6*2 /* 20 minutes */ );
+ m_freeDialog = 0;
}
MediaNotifier::~MediaNotifier()
@@ -103,12 +112,12 @@ bool MediaNotifier::autostart( const KFileItem &medium )
{
QString mimetype = medium.mimetype();
- bool is_cdrom = mimetype.startsWith( "cd" ) || mimetype.startsWith( "dvd" );
- bool is_mounted = mimetype.endsWith( "_mounted" );
+ bool is_cdrom = mimetype.startsWith( "media/cd" ) || mimetype.startsWith( "media/dvd" );
+ bool is_mounted = mimetype.contains( "_mounted" );
// We autorun only on CD/DVD or removable disks (USB, Firewire)
if ( !( is_cdrom || is_mounted )
- && mimetype!="media/removable_mounted" )
+ && !mimetype.startsWith("media/removable_mounted") )
{
return false;
}
@@ -309,4 +318,69 @@ extern "C"
}
}
+void MediaNotifier::checkFreeDiskSpace()
+{
+ struct statfs sfs;
+ long total, avail;
+ if ( m_freeDialog )
+ return;
+
+ if ( statfs( QFile::encodeName( QDir::homeDirPath() ), &sfs ) == 0 )
+ {
+ total = sfs.f_blocks;
+ avail = ( getuid() ? sfs.f_bavail : sfs.f_bfree );
+
+ if (avail < 0 || total <= 0)
+ return; // we better do not say anything about it
+
+ int freeperc = static_cast(100 * double(avail) / total);
+
+ if ( freeperc < 5 && KMessageBox::shouldBeShownContinue( "dontagainfreespace" ) ) // free disk space dropped under a limit
+ {
+ m_freeDialog= new KDialogBase(
+ i18n( "Low Disk Space" ),
+ KDialogBase::Yes | KDialogBase::No,
+ KDialogBase::Yes, KDialogBase::No,
+ 0, "warningYesNo", false, true,
+ i18n( "Start Konqueror" ), KStdGuiItem::cancel());
+
+ QString text = i18n( "You are running low on disk space on your home partition (currently %1% free), would you like to "
+ "run Konqueror to free some disk space and fix the problem?" ).arg( freeperc );
+ bool checkboxResult = false;
+ KMessageBox::createKMessageBox(m_freeDialog, QMessageBox::Warning, text, QStringList(),
+ i18n("Do not ask again"),
+ &checkboxResult, KMessageBox::Notify | KMessageBox::NoExec);
+ m_freeDialog->show();
+ connect( m_freeDialog, SIGNAL( yesClicked() ), SLOT( slotFreeContinue() ) );
+ connect( m_freeDialog, SIGNAL( noClicked() ), SLOT( slotFreeCancel() ) );
+ }
+ }
+}
+
+void MediaNotifier::slotFreeContinue()
+{
+ slotFreeFinished( KMessageBox::Continue );
+}
+
+void MediaNotifier::slotFreeCancel()
+{
+ slotFreeFinished( KMessageBox::Cancel );
+}
+
+void MediaNotifier::slotFreeFinished( KMessageBox::ButtonCode res )
+{
+ QCheckBox *checkbox = ::qt_cast( m_freeDialog->child( 0, "QCheckBox" ) );
+ if ( checkbox && checkbox->isChecked() )
+ KMessageBox::saveDontShowAgainYesNo("dontagainfreespace", res);
+ m_freeDialog->delayedDestruct();
+ m_freeDialog = 0;
+
+ if ( res == KMessageBox::Continue ) // start Konqi
+ {
+ ( void ) new KRun( KURL::fromPathOrURL( QDir::homeDirPath() ) );
+ }
+ else // people don't want to be bothered, at least stop the timer; there's no way to save the dontshowagain entry in this case
+ m_freeTimer->stop();
+}
+
#include "medianotifier.moc"
diff --git a/kioslave/media/medianotifier/medianotifier.h b/kioslave/media/medianotifier/medianotifier.h
index c3e4b9bf9..e070ac7ac 100644
--- a/kioslave/media/medianotifier/medianotifier.h
+++ b/kioslave/media/medianotifier/medianotifier.h
@@ -23,10 +23,13 @@
#include
#include
#include
+#include
#include
#include
+class KDialogBase;
+
class MediaNotifier: public KDEDModule
{
Q_OBJECT
@@ -41,6 +44,10 @@ k_dcop:
private slots:
void slotStatResult( KIO::Job *job );
+ void checkFreeDiskSpace();
+ void slotFreeFinished( KMessageBox::ButtonCode );
+ void slotFreeContinue();
+ void slotFreeCancel();
private:
bool autostart( const KFileItem &medium );
@@ -52,6 +59,8 @@ private:
const QString &autoopenFile );
QMap m_allowNotificationMap;
+ QTimer * m_freeTimer;
+ KDialogBase * m_freeDialog;
};
#endif
diff --git a/kioslave/media/mimetypes/Makefile.am b/kioslave/media/mimetypes/Makefile.am
index 25c718035..cdb66a1ac 100644
--- a/kioslave/media/mimetypes/Makefile.am
+++ b/kioslave/media/mimetypes/Makefile.am
@@ -4,10 +4,20 @@ mimetype_DATA = floppy_mounted.desktop floppy_unmounted.desktop \
floppy5_unmounted.desktop floppy5_mounted.desktop \
zip_mounted.desktop zip_unmounted.desktop \
hdd_mounted.desktop hdd_unmounted.desktop \
+ hdd_mounted_decrypted.desktop hdd_unmounted_encrypted.desktop \
+ hdd_unmounted_decrypted.desktop \
removable_mounted.desktop removable_unmounted.desktop \
+ removable_mounted_decrypted.desktop removable_unmounted_encrypted.desktop \
+ removable_unmounted_decrypted.desktop \
cdrom_mounted.desktop cdrom_unmounted.desktop \
+ cdrom_mounted_decrypted.desktop cdrom_unmounted_encrypted.desktop \
+ cdrom_unmounted_decrypted.desktop \
dvd_mounted.desktop dvd_unmounted.desktop \
+ dvd_mounted_decrypted.desktop dvd_unmounted_encrypted.desktop \
+ dvd_unmounted_decrypted.desktop \
cdwriter_mounted.desktop cdwriter_unmounted.desktop \
+ cdwriter_mounted_decrypted.desktop cdwriter_unmounted_encrypted.desktop \
+ cdwriter_unmounted_decrypted.desktop \
smb_mounted.desktop smb_unmounted.desktop \
nfs_mounted.desktop nfs_unmounted.desktop \
audiocd.desktop \
diff --git a/kioslave/media/mimetypes/cdrom_mounted_decrypted.desktop b/kioslave/media/mimetypes/cdrom_mounted_decrypted.desktop
new file mode 100644
index 000000000..2729ff4f5
--- /dev/null
+++ b/kioslave/media/mimetypes/cdrom_mounted_decrypted.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Icon=cdrom_mount_decrypt
+Type=MimeType
+MimeType=media/cdrom_mounted_decrypted
+Comment=Mounted Decrypted CD-ROM
+Comment[de]=Eingebundene, entschlüsselte CD-ROM
+Patterns=
+
+X-KDE-AutoEmbed=true
+X-KDE-IsAlso=inode/directory
diff --git a/kioslave/media/mimetypes/cdrom_unmounted_decrypted.desktop b/kioslave/media/mimetypes/cdrom_unmounted_decrypted.desktop
new file mode 100644
index 000000000..d6b2be0c2
--- /dev/null
+++ b/kioslave/media/mimetypes/cdrom_unmounted_decrypted.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Icon=cdrom_unmount_decrypt
+Type=MimeType
+MimeType=media/cdrom_unmounted_decrypted
+Comment=Unmounted Decrypted CD-ROM
+Comment[de]=Nicht eingebundene, entschlüsselte CD-ROM
+Patterns=
+
+X-KDE-AutoEmbed=true
+X-KDE-IsAlso=inode/directory
diff --git a/kioslave/media/mimetypes/cdrom_unmounted_encrypted.desktop b/kioslave/media/mimetypes/cdrom_unmounted_encrypted.desktop
new file mode 100644
index 000000000..95fa31b3b
--- /dev/null
+++ b/kioslave/media/mimetypes/cdrom_unmounted_encrypted.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Icon=cdrom_unmount_encrypt
+Type=MimeType
+MimeType=media/cdrom_unmounted_encrypted
+Comment=Unmounted Encrypted CD-ROM
+Comment[de]=Nicht eingebundene, verschlüsselte CD-ROM
+Patterns=
+
+X-KDE-AutoEmbed=true
+X-KDE-IsAlso=inode/directory
diff --git a/kioslave/media/mimetypes/cdwriter_mounted_decrypted.desktop b/kioslave/media/mimetypes/cdwriter_mounted_decrypted.desktop
new file mode 100644
index 000000000..b831be152
--- /dev/null
+++ b/kioslave/media/mimetypes/cdwriter_mounted_decrypted.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Icon=cdwriter_mount_decrypt
+Type=MimeType
+MimeType=media/cdwriter_mounted_decrypted
+Comment=Mounted Decrypted CD Writer
+Comment[de]=Eingebundener, entschlüsselter CD-Brenner
+Patterns=
+
+X-KDE-AutoEmbed=true
+X-KDE-IsAlso=inode/directory
diff --git a/kioslave/media/mimetypes/cdwriter_unmounted_decrypted.desktop b/kioslave/media/mimetypes/cdwriter_unmounted_decrypted.desktop
new file mode 100644
index 000000000..48f49ccb4
--- /dev/null
+++ b/kioslave/media/mimetypes/cdwriter_unmounted_decrypted.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Icon=cdwriter_unmount_decrypt
+Type=MimeType
+MimeType=media/cdwriter_unmounted_decrypted
+Comment=Unmounted Decrypted CD Writer
+Comment[de]=Nicht eingebundener, entschlüsselter CD-Brenner
+Patterns=
+
+X-KDE-AutoEmbed=true
+X-KDE-IsAlso=inode/directory
diff --git a/kioslave/media/mimetypes/cdwriter_unmounted_encrypted.desktop b/kioslave/media/mimetypes/cdwriter_unmounted_encrypted.desktop
new file mode 100644
index 000000000..c31e66089
--- /dev/null
+++ b/kioslave/media/mimetypes/cdwriter_unmounted_encrypted.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Icon=cdwriter_unmount_encrypt
+Type=MimeType
+MimeType=media/cdwriter_unmounted_encrypted
+Comment=Unmounted Encrypted CD Writer
+Comment[de]=Nicht eingebundener, entschlüsselter CD-Brenner
+Patterns=
+
+X-KDE-AutoEmbed=true
+X-KDE-IsAlso=inode/directory
diff --git a/kioslave/media/mimetypes/dvd_mounted_decrypted.desktop b/kioslave/media/mimetypes/dvd_mounted_decrypted.desktop
new file mode 100644
index 000000000..22a90b52d
--- /dev/null
+++ b/kioslave/media/mimetypes/dvd_mounted_decrypted.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Icon=dvd_mount_decrypt
+Type=MimeType
+MimeType=media/dvd_mounted_decrypted
+Comment=Mounted Decrypted DVD
+Comment[de]=Eingebundene, entschlüsselte DVD
+Patterns=
+
+X-KDE-AutoEmbed=true
+X-KDE-IsAlso=inode/directory
diff --git a/kioslave/media/mimetypes/dvd_unmounted_decrypted.desktop b/kioslave/media/mimetypes/dvd_unmounted_decrypted.desktop
new file mode 100644
index 000000000..129f3f177
--- /dev/null
+++ b/kioslave/media/mimetypes/dvd_unmounted_decrypted.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Icon=dvd_unmount_decrypt
+Type=MimeType
+MimeType=media/dvd_unmounted_decrypted
+Comment=Unmounted Decrypted DVD
+Comment[de]=Nicht eingebundene, entschlüsselte DVD
+Patterns=
+
+X-KDE-AutoEmbed=true
+X-KDE-IsAlso=inode/directory
diff --git a/kioslave/media/mimetypes/dvd_unmounted_encrypted.desktop b/kioslave/media/mimetypes/dvd_unmounted_encrypted.desktop
new file mode 100644
index 000000000..23d2353b5
--- /dev/null
+++ b/kioslave/media/mimetypes/dvd_unmounted_encrypted.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Icon=dvd_unmount_encrypt
+Type=MimeType
+MimeType=media/dvd_unmounted_encrypted
+Comment=Unmounted Encrypted DVD
+Comment[de]=Nicht eingebundene, verschlüsselte DVD
+Patterns=
+
+X-KDE-AutoEmbed=true
+X-KDE-IsAlso=inode/directory
diff --git a/kioslave/media/mimetypes/hdd_mounted_decrypted.desktop b/kioslave/media/mimetypes/hdd_mounted_decrypted.desktop
new file mode 100644
index 000000000..f4b1c1749
--- /dev/null
+++ b/kioslave/media/mimetypes/hdd_mounted_decrypted.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Icon=hdd_mount_decrypt
+Type=MimeType
+MimeType=media/hdd_mounted_decrypted
+Comment=Mounted Decrypted Hard Disk Volume
+Comment[de]=Eingebundene, entschlüsselte Festplattenpartition
+Patterns=
+
+X-KDE-AutoEmbed=true
+X-KDE-IsAlso=inode/directory
diff --git a/kioslave/media/mimetypes/hdd_unmounted_decrypted.desktop b/kioslave/media/mimetypes/hdd_unmounted_decrypted.desktop
new file mode 100644
index 000000000..f41411314
--- /dev/null
+++ b/kioslave/media/mimetypes/hdd_unmounted_decrypted.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Icon=hdd_unmount_decrypt
+Type=MimeType
+MimeType=media/hdd_unmounted_decrypted
+Comment=Unmounted Decrypted Hard Disk Volume
+Comment[de]=Nicht eingebundene, entschlüsselte Festplattenpartition
+Patterns=
+
+X-KDE-AutoEmbed=true
+X-KDE-IsAlso=inode/directory
diff --git a/kioslave/media/mimetypes/hdd_unmounted_encrypted.desktop b/kioslave/media/mimetypes/hdd_unmounted_encrypted.desktop
new file mode 100644
index 000000000..60e277811
--- /dev/null
+++ b/kioslave/media/mimetypes/hdd_unmounted_encrypted.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Icon=hdd_unmount_encrypt
+Type=MimeType
+MimeType=media/hdd_unmounted_encrypted
+Comment=Unmounted Encrypted Hard Disk Volume
+Comment[de]=Nicht eingebundene, verschlüsselte Festplattenpartition
+Patterns=
+
+X-KDE-AutoEmbed=true
+X-KDE-IsAlso=inode/directory
diff --git a/kioslave/media/mimetypes/removable_mounted_decrypted.desktop b/kioslave/media/mimetypes/removable_mounted_decrypted.desktop
new file mode 100644
index 000000000..6a025119d
--- /dev/null
+++ b/kioslave/media/mimetypes/removable_mounted_decrypted.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Icon=usbpendrive_mount_decrypt
+Type=MimeType
+MimeType=media/removable_mounted_decrypted
+Comment=Mounted Decrypted Removable Medium
+Comment[de]=Eingebundenes, entschlüsseltes Wechsellaufwerk
+Patterns=
+
+X-KDE-AutoEmbed=true
+X-KDE-IsAlso=inode/directory
diff --git a/kioslave/media/mimetypes/removable_unmounted_decrypted.desktop b/kioslave/media/mimetypes/removable_unmounted_decrypted.desktop
new file mode 100644
index 000000000..fe3ecd6a8
--- /dev/null
+++ b/kioslave/media/mimetypes/removable_unmounted_decrypted.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Icon=usbpendrive_unmount_decrypt
+Type=MimeType
+MimeType=media/removable_unmounted_decrypted
+Comment=Unmounted Decrypted Removable Medium
+Comment[de]=Nicht eingebundenes, entschlüsseltes Wechsellaufwerk
+Patterns=
+
+X-KDE-AutoEmbed=true
+X-KDE-IsAlso=inode/directory
diff --git a/kioslave/media/mimetypes/removable_unmounted_encrypted.desktop b/kioslave/media/mimetypes/removable_unmounted_encrypted.desktop
new file mode 100644
index 000000000..e2949bfed
--- /dev/null
+++ b/kioslave/media/mimetypes/removable_unmounted_encrypted.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Icon=usbpendrive_unmount_encrypt
+Type=MimeType
+MimeType=media/removable_unmounted_encrypted
+Comment=Unmounted Encrypted Removable Medium
+Comment[de]=Nicht eingebundenes, verschlüsseltes Wechsellaufwerk
+Patterns=
+
+X-KDE-AutoEmbed=true
+X-KDE-IsAlso=inode/directory
diff --git a/kioslave/media/mounthelper/Makefile.am b/kioslave/media/mounthelper/Makefile.am
index 9080ba81a..9c03ba688 100644
--- a/kioslave/media/mounthelper/Makefile.am
+++ b/kioslave/media/mounthelper/Makefile.am
@@ -3,10 +3,10 @@ bin_PROGRAMS = kio_media_mounthelper
INCLUDES = -I$(srcdir)/../libmediacommon $(all_includes)
AM_LDFLAGS = $(all_libraries)
-kio_media_mounthelper_SOURCES = kio_media_mounthelper.cpp
+kio_media_mounthelper_SOURCES = kio_media_mounthelper.cpp decryptdialog.ui dialog.cpp
kio_media_mounthelper_LDFLAGS = $(KDE_RPATH) $(all_libraries)
-kio_media_mounthelper_LDADD = ../libmediacommon/libmediacommon.la $(LIB_KIO)
+kio_media_mounthelper_LDADD = ../libmediacommon/libmediacommon.la $(LIB_KIO) $(LIB_KDEUI)
METASOURCES = AUTO
diff --git a/kioslave/media/mounthelper/decryptdialog.ui b/kioslave/media/mounthelper/decryptdialog.ui
new file mode 100644
index 000000000..15790c8ef
--- /dev/null
+++ b/kioslave/media/mounthelper/decryptdialog.ui
@@ -0,0 +1,201 @@
+
+DecryptDialog
+
+
+ DecryptDialog
+
+
+
+ 0
+ 0
+ 207
+ 172
+
+
+
+
+ 5
+ 3
+ 0
+ 0
+
+
+
+ Decrypting Storage Device
+
+
+
+ unnamed
+
+
+
+ layout5
+
+
+
+ unnamed
+
+
+
+ layout4
+
+
+
+ unnamed
+
+
+
+ encryptedIcon
+
+
+
+ 0
+ 0
+ 0
+ 0
+
+
+
+
+ 48
+ 48
+
+
+
+
+ 32
+ 32
+
+
+
+ true
+
+
+ AlignTop
+
+
+
+
+ spacer2_2
+
+
+ Vertical
+
+
+ Expanding
+
+
+
+ 31
+ 41
+
+
+
+
+
+
+
+ descLabel
+
+
+
+ 3
+ 3
+ 0
+ 0
+
+
+
+ <p><b>%1</b> is an encrypted storage device.</p>
+<p>Please enter the password to decrypt the storage device.</p>
+
+
+ WordBreak|AlignTop
+
+
+
+
+
+
+ layout4
+
+
+
+ unnamed
+
+
+
+ textLabel1
+
+
+ &Password:
+
+
+ passwordEdit
+
+
+
+
+ passwordEdit
+
+
+ true
+
+
+
+ 5
+ 0
+ 1
+ 0
+
+
+
+ Password
+
+
+
+
+
+
+ errorBox
+
+
+
+ 3
+ 3
+ 0
+ 0
+
+
+
+ Error
+
+
+
+ unnamed
+
+
+
+ errorLabel
+
+
+
+ 3
+ 3
+ 0
+ 0
+
+
+
+
+
+
+ WordBreak|AlignTop
+
+
+
+
+
+
+
+
diff --git a/kioslave/media/mounthelper/dialog.cpp b/kioslave/media/mounthelper/dialog.cpp
new file mode 100644
index 000000000..74bcfb388
--- /dev/null
+++ b/kioslave/media/mounthelper/dialog.cpp
@@ -0,0 +1,68 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2007 Jan Klötzke
+ *
+ * Based on kryptomedia- Another KDE cryto media application.
+ * Copyright (C) 2006 Daniel Gollub
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "dialog.h"
+
+Dialog::Dialog(QString url, QString iconName) :
+ KDialogBase(NULL, "Dialog", true, "Decrypt Storage Device", (Cancel|User1), User1, false, KGuiItem(i18n("Decrypt"), "decrypted" ))
+{
+ decryptDialog = new DecryptDialog(this);
+
+ decryptDialog->errorBox->hide();
+ decryptDialog->descLabel->setText(decryptDialog->descLabel->text().arg(url));
+ decryptDialog->descLabel->adjustSize();
+ decryptDialog->adjustSize();
+
+ enableButton( User1, false );
+
+ QPixmap pixmap = KGlobal::iconLoader()->loadIcon(iconName, KIcon::NoGroup, KIcon::SizeLarge);
+ decryptDialog->encryptedIcon->setPixmap( pixmap );
+
+ connect(decryptDialog->passwordEdit, SIGNAL (textChanged(const QString &)), this, SLOT (slotPasswordChanged(const QString &)));
+
+ setMainWidget(decryptDialog);
+}
+
+Dialog::~Dialog()
+{
+ delete decryptDialog;
+}
+
+QString Dialog::getPassword()
+{
+ return decryptDialog->passwordEdit->text();
+}
+
+void Dialog::slotDialogError(QString errorMsg)
+{
+ kdDebug() << __func__ << "(" << errorMsg << " )" << endl;
+
+ decryptDialog->errorLabel->setText(QString("%1").arg(errorMsg));
+ decryptDialog->errorBox->show();
+}
+
+void Dialog::slotPasswordChanged(const QString &text)
+{
+ enableButton( User1, !text.isEmpty() );
+}
+
+#include "dialog.moc"
diff --git a/kioslave/media/mounthelper/dialog.h b/kioslave/media/mounthelper/dialog.h
new file mode 100644
index 000000000..1f544c370
--- /dev/null
+++ b/kioslave/media/mounthelper/dialog.h
@@ -0,0 +1,61 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2007 Jan Klötzke
+ *
+ * Based on kryptomedia- Another KDE cryto media application.
+ * Copyright (C) 2006 Daniel Gollub
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef DIALOG_H_
+#define DIALOG_H_
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include "decryptdialog.h"
+
+class KryptoMedia;
+
+class Dialog : public KDialogBase
+{
+
+Q_OBJECT
+
+public:
+ Dialog(QString url, QString iconName);
+ ~Dialog();
+
+ QString getPassword();
+
+public slots:
+ void slotDialogError(QString errorMsg);
+ void slotPasswordChanged(const QString &text);
+
+private:
+ DecryptDialog *decryptDialog;
+};
+
+#endif // DIALOG_H_
+
diff --git a/kioslave/media/mounthelper/kio_media_mounthelper.cpp b/kioslave/media/mounthelper/kio_media_mounthelper.cpp
index 12743847f..5dae9e0d3 100644
--- a/kioslave/media/mounthelper/kio_media_mounthelper.cpp
+++ b/kioslave/media/mounthelper/kio_media_mounthelper.cpp
@@ -32,7 +32,9 @@
#include
#include
#include
+#include
+#include "dialog.h"
#include "kio_media_mounthelper.h"
const Medium MountHelper::findMedium(const KURL &url)
@@ -63,7 +65,7 @@ MountHelper::MountHelper() : KApplication()
{
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
- m_errorStr = "";
+ m_errorStr = QString::null;
KURL url(args->url(0));
const Medium medium = findMedium(url);
@@ -89,7 +91,37 @@ MountHelper::MountHelper() : KApplication()
m_isCdrom = medium.mimeType().find("dvd")!=-1
|| medium.mimeType().find("cd")!=-1;
- if (args->isSet("u"))
+ if (args->isSet("d"))
+ {
+ if (!medium.isEncrypted())
+ {
+ m_errorStr = i18n("%1 is not an encrypted media.").arg(url.prettyURL());
+ QTimer::singleShot(0, this, SLOT(error()) );
+ return;
+ }
+ if (!medium.needDecryption())
+ {
+ m_errorStr = i18n("%1 is already decrypted.").arg(url.prettyURL());
+ QTimer::singleShot(0, this, SLOT(error()) );
+ return;
+ }
+
+ QString iconName = medium.iconName();
+ if (iconName.isEmpty())
+ {
+ QString mime = medium.mimeType();
+ iconName = KMimeType::mimeType(mime)->icon(mime, false);
+ }
+
+ m_mediumId = medium.id();
+ dialog = new Dialog(url.prettyURL(), iconName);
+ dialog->show();
+
+ connect(dialog, SIGNAL (user1Clicked()), this, SLOT (slotSendPassword()));
+ connect(dialog, SIGNAL (cancelClicked()), this, SLOT (slotCancel()));
+ connect(this, SIGNAL (signalPasswordError(QString)), dialog, SLOT (slotDialogError(QString)));
+ }
+ else if (args->isSet("u"))
{
DCOPRef mediamanager("kded", "mediamanager");
DCOPReply reply = mediamanager.call( "unmount", medium.id());
@@ -103,6 +135,8 @@ MountHelper::MountHelper() : KApplication()
}
else if (args->isSet("s") || args->isSet("e"))
{
+ DCOPRef mediamanager("kded", "mediamanager");
+
/*
* We want to call mediamanager unmount before invoking eject. That's
* because unmount would provide an informative error message in case of
@@ -114,17 +148,24 @@ MountHelper::MountHelper() : KApplication()
*/
if (medium.isMounted())
{
- DCOPRef mediamanager("kded", "mediamanager");
DCOPReply reply = mediamanager.call( "unmount", medium.id());
if (reply.isValid())
reply.get(m_errorStr);
- if (m_errorStr.isNull())
- invokeEject(device, true);
- else
- error();
- m_device = device;
- } else
- invokeEject(device, true);
+ }
+
+ /* If this is a decrypted volume and there is no error yet
+ * we try to teardown the decryption */
+ if (m_errorStr.isNull() && medium.isEncrypted() && !medium.clearDeviceUdi().isNull())
+ {
+ DCOPReply reply = mediamanager.call( "undecrypt", medium.id());
+ if (reply.isValid())
+ reply.get(m_errorStr);
+ }
+
+ if (m_errorStr.isNull())
+ invokeEject(device, true);
+ else
+ error();
}
else
{
@@ -167,7 +208,9 @@ void MountHelper::ejectFinished(KProcess* proc)
else
m_errorStr = i18n("The device was successfully unmounted, but could not be ejected");
}
- QTimer::singleShot(0, this, SLOT(error()));
+//X Comment this because the error is useless as long as the unmount is successfull.
+//X QTimer::singleShot(0, this, SLOT(error()));
+ ::exit(0);
}
}
@@ -177,8 +220,32 @@ void MountHelper::error()
::exit(1);
}
+void MountHelper::slotSendPassword()
+{
+ DCOPRef mediamanager("kded", "mediamanager");
+
+ DCOPReply reply = mediamanager.call( "decrypt", m_mediumId, dialog->getPassword() );
+ if (!reply.isValid()) {
+ m_errorStr = i18n("The KDE mediamanager is not running.");
+ error();
+ } else {
+ QString errorMsg = reply;
+ if (errorMsg.isNull()) {
+ exit(0);
+ } else {
+ emit signalPasswordError(errorMsg);
+ }
+ }
+}
+
+void MountHelper::slotCancel()
+{
+ exit(0);
+}
+
static KCmdLineOptions options[] =
{
+ { "d", I18N_NOOP("Decrypt given URL"), 0 },
{ "u", I18N_NOOP("Unmount given URL"), 0 },
{ "m", I18N_NOOP("Mount given URL (default)"), 0 },
{ "e", I18N_NOOP("Eject given URL via kdeeject"), 0},
diff --git a/kioslave/media/mounthelper/kio_media_mounthelper.h b/kioslave/media/mounthelper/kio_media_mounthelper.h
index 478d802f9..ed5884d4f 100644
--- a/kioslave/media/mounthelper/kio_media_mounthelper.h
+++ b/kioslave/media/mounthelper/kio_media_mounthelper.h
@@ -28,6 +28,8 @@
#include "medium.h"
+class Dialog;
+
class MountHelper : public KApplication
{
Q_OBJECT
@@ -38,12 +40,18 @@ private:
const Medium findMedium(const KURL &url);
void invokeEject(const QString &device, bool quiet=false);
QString m_errorStr;
- QString m_device;
bool m_isCdrom;
+ QString m_mediumId;
+ Dialog *dialog;
private slots:
+ void slotSendPassword();
+ void slotCancel();
void ejectFinished(KProcess* proc);
void error();
+
+signals:
+ void signalPasswordError(QString errorMsg);
};
#endif
diff --git a/kioslave/media/propsdlgplugin/media_propsdlgplugin.desktop b/kioslave/media/propsdlgplugin/media_propsdlgplugin.desktop
index c0cdcbbba..d5e13eda5 100644
--- a/kioslave/media/propsdlgplugin/media_propsdlgplugin.desktop
+++ b/kioslave/media/propsdlgplugin/media_propsdlgplugin.desktop
@@ -99,4 +99,4 @@ Comment[wa]=Tchôke-divins di dvize di prôpietés Konqueror po-z apontyî l' du
Comment[zh_CN]=配置挂载行为的 Konqueror 属性对话框插件
Comment[zh_TW]=Konqueror 內容對話框外掛程式,用於設定掛載的行為
X-KDE-Library=media_propsdlgplugin
-ServiceTypes=KPropsDlg/Plugin,media/audiocd,media/hdd_mounted,media/hdd_unmounted,media/cdrom_mounted,media/cdrom_unmounted,media/cdwriter_mounted,media/nfs_mounted,media/cdwriter_unmounted,media/nfs_unmounted,media/removable_mounted,media/dvd_mounted,media/removable_unmounted,media/dvd_unmounted,media/smb_mounted,media/dvdvideo,media/smb_unmounted,media/floppy5_mounted,media/floppy5_unmounted,media/floppy_mounted,media/zip_mounted,media/floppy_unmounted,media/zip_unmounted,media/camera_mounted,media/camera_unmounted
+ServiceTypes=KPropsDlg/Plugin,media/audiocd,media/hdd_mounted,media/hdd_unmounted,media/hdd_mounted_decrypted,media/hdd_unmounted_decrypted,media/cdrom_mounted,media/cdrom_unmounted,media/cdrom_mounted_decrypted,media/cdrom_unmounted_decrypted,media/cdwriter_mounted,media/cdwriter_mounted_decrypted,media/nfs_mounted,media/cdwriter_unmounted,media/cdwriter_unmounted_decrypted,media/nfs_unmounted,media/removable_mounted,media/removable_mounted_decrypted,media/dvd_mounted,media/dvd_mounted_decrypted,media/removable_unmounted,media/removable_unmounted_decrypted,media/dvd_unmounted,media/dvd_unmounted_decrypted,media/smb_mounted,media/dvdvideo,media/smb_unmounted,media/floppy5_mounted,media/floppy5_unmounted,media/floppy_mounted,media/zip_mounted,media/floppy_unmounted,media/zip_unmounted,media/camera_mounted,media/camera_unmounted
diff --git a/kioslave/media/services/Makefile.am b/kioslave/media/services/Makefile.am
index dded3c403..c744934f2 100644
--- a/kioslave/media/services/Makefile.am
+++ b/kioslave/media/services/Makefile.am
@@ -1,3 +1,3 @@
servicesdir = $(kde_datadir)/konqueror/servicemenus
-services_DATA = media_mount.desktop media_unmount.desktop media_eject.desktop media_safelyremove.desktop
+services_DATA = media_decrypt.desktop media_mount.desktop media_unmount.desktop media_eject.desktop media_safelyremove.desktop
diff --git a/kioslave/media/services/media_decrypt.desktop b/kioslave/media/services/media_decrypt.desktop
new file mode 100644
index 000000000..dd8dadc39
--- /dev/null
+++ b/kioslave/media/services/media_decrypt.desktop
@@ -0,0 +1,9 @@
+[Desktop Action Decrypt]
+Exec=kio_media_mounthelper -d %u
+Icon=decrypted
+Name=Decrypt
+Name[de]=Entschlüsseln
+
+[Desktop Entry]
+Actions=Decrypt
+ServiceTypes=media/removable_unmounted_encrypted,media/hdd_unmounted_encrypted,media/cdrom_unmounted_encrypted,media/cdwriter_unmounted_encrypted,media/dvd_unmounted_encrypted
diff --git a/kioslave/media/services/media_eject.desktop b/kioslave/media/services/media_eject.desktop
index 1ecd29fa8..f5ab3582e 100644
--- a/kioslave/media/services/media_eject.desktop
+++ b/kioslave/media/services/media_eject.desktop
@@ -1,5 +1,5 @@
[Desktop Entry]
-ServiceTypes=media/cdrom_mounted,media/cdrom_unmounted,media/cdwriter_mounted,media/cdwriter_unmounted,media/dvd_mounted,media/dvd_unmounted,media/audiocd,media/blankcd,media/blankdvd,media/dvdvideo,media/svcd,media/vcd
+ServiceTypes=media/cdrom_mounted,media/cdrom_unmounted,media/cdrom_mounted_decrypted,media/cdrom_unmounted_decrypted,media/cdrom_unmounted_encrypted,media/cdwriter_mounted,media/cdwriter_unmounted,media/cdwriter_mounted_decrypted,media/cdwriter_unmounted_decrypted,media/cdwriter_unmounted_encrypted,media/dvd_mounted,media/dvd_unmounted,media/dvd_mounted_decrypted,media/dvd_unmounted_decrypted,media/dvd_unmounted_encrypted,media/audiocd,media/blankcd,media/blankdvd,media/dvdvideo,media/svcd,media/vcd
Actions=MediaEject;
X-KDE-Priority=TopLevel
X-KDE-MediaNotifierHide=true
diff --git a/kioslave/media/services/media_mount.desktop b/kioslave/media/services/media_mount.desktop
index 1779d2208..b2166f8ea 100644
--- a/kioslave/media/services/media_mount.desktop
+++ b/kioslave/media/services/media_mount.desktop
@@ -1,5 +1,5 @@
[Desktop Entry]
-ServiceTypes=media/cdrom_unmounted,media/cdwriter_unmounted,media/dvd_unmounted,media/floppy5_unmounted,media/floppy_unmounted,media/hdd_unmounted,media/nfs_unmounted,media/removable_unmounted,media/smb_unmounted,media/zip_unmounted,media/camera_unmounted
+ServiceTypes=media/cdrom_unmounted,media/cdrom_unmounted_decrypted,media/cdwriter_unmounted,media/cdwriter_unmounted_decrypted,media/dvd_unmounted,media/dvd_unmounted_decrypted,media/floppy5_unmounted,media/floppy_unmounted,media/hdd_unmounted,media/hdd_unmounted_decrypted,media/nfs_unmounted,media/removable_unmounted,media/removable_unmounted_decrypted,media/smb_unmounted,media/zip_unmounted,media/camera_unmounted
Actions=MediaMount;
X-KDE-Priority=TopLevel
X-KDE-MediaNotifierHide=true
diff --git a/kioslave/media/services/media_safelyremove.desktop b/kioslave/media/services/media_safelyremove.desktop
index 298a5f2e5..ce92f348c 100644
--- a/kioslave/media/services/media_safelyremove.desktop
+++ b/kioslave/media/services/media_safelyremove.desktop
@@ -1,5 +1,5 @@
[Desktop Entry]
-ServiceTypes=media/removable_mounted,media/removable_unmounted,media/camera_mounted,media/camera_unmounted
+ServiceTypes=media/removable_mounted,media/removable_mounted_decrypted,media/removable_unmounted,media/removable_unmounted_decrypted,media/camera_mounted,media/camera_unmounted
Actions=MediaSafelyRemove;
X-KDE-Priority=TopLevel
X-KDE-MediaNotifierHide=true
diff --git a/kioslave/media/services/media_unmount.desktop b/kioslave/media/services/media_unmount.desktop
index 537750095..5877e484e 100644
--- a/kioslave/media/services/media_unmount.desktop
+++ b/kioslave/media/services/media_unmount.desktop
@@ -1,5 +1,5 @@
[Desktop Entry]
-ServiceTypes=media/cdrom_mounted,media/cdwriter_mounted,media/dvd_mounted,media/floppy5_mounted,media/floppy_mounted,media/hdd_mounted,media/nfs_mounted,media/smb_mounted,media/zip_mounted,media/vcd,media/svcd,media/dvdvideo
+ServiceTypes=media/cdrom_mounted,media/cdrom_mounted_decrypted,media/cdwriter_mounted,media/cdwriter_mounted_decrypted,media/dvd_mounted,media/dvd_mounted_decrypted,media/floppy5_mounted,media/floppy_mounted,media/hdd_mounted,media/hdd_mounted_decrypted,media/nfs_mounted,media/smb_mounted,media/zip_mounted,media/vcd,media/svcd,media/dvdvideo
Actions=MediaUnmount;
X-KDE-Priority=TopLevel
X-KDE-MediaNotifierHide=true
diff --git a/kioslave/nfs/kio_nfs.cpp b/kioslave/nfs/kio_nfs.cpp
index 18a7f1393..b35489c8d 100644
--- a/kioslave/nfs/kio_nfs.cpp
+++ b/kioslave/nfs/kio_nfs.cpp
@@ -89,7 +89,7 @@ int x_getdomainname(char *name, size_t len)
{
if ((hent = gethostbyname(uts.nodename)) != 0L)
{
- char *p = strchr(hent->h_name, '.');
+ char *p = (char*)strchr(hent->h_name, '.');
if (p != 0L)
{
++p;
diff --git a/kioslave/system/systemimpl.cpp b/kioslave/system/systemimpl.cpp
index f773dc20e..46214ce20 100644
--- a/kioslave/system/systemimpl.cpp
+++ b/kioslave/system/systemimpl.cpp
@@ -228,8 +228,16 @@ void SystemImpl::createEntry(KIO::UDSEntry &entry,
QString new_filename = file;
new_filename.truncate(file.length()-8);
- addAtom(entry, KIO::UDS_URL, 0, "system:/"+new_filename);
+ if ( desktop.readURL().isEmpty() )
+ {
+ addAtom(entry, KIO::UDS_URL, 0, desktop.readPath());
+ }
+ else
+ {
+ addAtom(entry, KIO::UDS_URL, 0, "system:/"+new_filename);
+ }
+
addAtom(entry, KIO::UDS_FILE_TYPE, S_IFDIR);
addAtom(entry, KIO::UDS_MIME_TYPE, 0, "inode/directory");
diff --git a/klipper/urlgrabber.cpp b/klipper/urlgrabber.cpp
index 352f3ab74..45d5f5e4b 100644
--- a/klipper/urlgrabber.cpp
+++ b/klipper/urlgrabber.cpp
@@ -51,7 +51,6 @@ URLGrabber::URLGrabber( KConfig* config )
{
if( m_config == NULL )
m_config = kapp->config();
- myCurrentAction = 0L;
myMenu = 0L;
myPopupKillTimeout = 8;
m_stripWhiteSpace = true;
@@ -160,6 +159,7 @@ void URLGrabber::actionMenu( bool wm_class_check )
QString item;
myCommandMapper.clear();
+ myGroupingMapper.clear();
myPopupKillTimer->stop();
delete myMenu;
@@ -184,6 +184,7 @@ void URLGrabber::actionMenu( bool wm_class_check )
else
id = myMenu->insertItem( SmallIcon(command->pixmap), item);
myCommandMapper.insert( id, command );
+ myGroupingMapper.insert( id, action->capturedTexts() );
}
}
@@ -224,19 +225,27 @@ void URLGrabber::slotItemSelected( int id )
break;
default:
ClipCommand *command = myCommandMapper.find( id );
- if ( !command )
+ QStringList *backrefs = myGroupingMapper.find( id );
+ if ( !command || !backrefs )
qWarning("Klipper: can't find associated action");
else
- execute( command );
+ execute( command, backrefs );
}
}
-void URLGrabber::execute( const struct ClipCommand *command ) const
+void URLGrabber::execute( const struct ClipCommand *command,
+ QStringList *backrefs) const
{
if ( command->isEnabled ) {
QMap map;
map.insert( 's', myClipData );
+ int brCounter = -1;
+ QStringList::Iterator it = backrefs->begin();
+ while( it != backrefs->end() ) {
+ map.insert( char(++brCounter + '0') , *it );
+ ++it;
+ }
QString cmdLine = KMacroExpander::expandMacrosShellQuote( command->command, map );
if ( cmdLine.isEmpty() )
diff --git a/klipper/urlgrabber.h b/klipper/urlgrabber.h
index ae39d648d..232455fa0 100644
--- a/klipper/urlgrabber.h
+++ b/klipper/urlgrabber.h
@@ -72,7 +72,8 @@ public:
private:
const ActionList& matchingActions( const QString& );
- void execute( const struct ClipCommand *command ) const;
+ void execute( const struct ClipCommand *command,
+ QStringList *backrefs ) const;
void editData();
bool isAvoidedWindow() const;
void actionMenu( bool wm_class_check );
@@ -83,6 +84,7 @@ private:
QString myClipData;
ClipAction *myCurrentAction;
QIntDict myCommandMapper;
+ QIntDict myGroupingMapper;
KPopupMenu *myMenu;
QTimer *myPopupKillTimer;
int myPopupKillTimeout;
@@ -127,8 +129,13 @@ public:
void setRegExp( const QString& r) { myRegExp = QRegExp( r ); }
QString regExp() const { return myRegExp.pattern(); }
- inline bool matches( const QString& string ) const {
- return ( myRegExp.search( string ) != -1 );
+ inline bool matches( const QString& string ) {
+ int res = myRegExp.search( string ) ;
+ if ( res != -1 ) {
+ myCapturedTexts = myRegExp.capturedTexts();
+ return true;
+ }
+ return false;
}
void setDescription( const QString& d) { myDescription = d; }
@@ -147,9 +154,15 @@ public:
*/
void save( KConfig * ) const;
+ /**
+ * Returns the most recent list of matched group backreferences.
+ * Note: you probably need to call matches() first.
+ */
+ inline const QStringList* capturedTexts() const { return &myCapturedTexts; }
private:
QRegExp myRegExp;
+ QStringList myCapturedTexts;
QString myDescription;
QPtrList myCommands;
diff --git a/konqueror/about/konq.css b/konqueror/about/konq.css
index 735861d9e..db6983bc1 100644
--- a/konqueror/about/konq.css
+++ b/konqueror/about/konq.css
@@ -18,4 +18,11 @@
background-repeat: no-repeat;
}
+#searchbarlabel {
+ font-size: 10pt;
+ font-style: italic;
+}
+#searchbarinput {
+ width: 100%;
+}
diff --git a/konqueror/about/konq_aboutpage.cc b/konqueror/about/konq_aboutpage.cc
index 03da9a060..8a5385697 100644
--- a/konqueror/about/konq_aboutpage.cc
+++ b/konqueror/about/konq_aboutpage.cc
@@ -11,6 +11,9 @@
#include
#include
#include
+#include
+#include
+#include
#include
#include
@@ -85,8 +88,11 @@ QString KonqAboutPageFactory::loadFile( const QString& file )
QString KonqAboutPageFactory::launch()
{
+ // FIXME: only regenerate launch page if kuriikwsfilterrc changed.
+ /*
if ( s_launch_html )
return *s_launch_html;
+ */
QString res = loadFile( locate( "data", "konqueror/about/launch.html" ));
if ( res.isEmpty() )
@@ -100,6 +106,7 @@ QString KonqAboutPageFactory::launch()
QString wastebin_icon_path = iconloader->iconPath("trashcan_full", KIcon::Desktop );
QString applications_icon_path = iconloader->iconPath("kmenu", KIcon::Desktop );
QString settings_icon_path = iconloader->iconPath("kcontrol", KIcon::Desktop );
+ QString help_icon_path = iconloader->iconPath("khelpcenter", KIcon::Desktop );
QString home_folder = QDir::homeDirPath();
QString continue_icon_path = QApplication::reverseLayout()?iconloader->iconPath("1leftarrow", KIcon::Small ):iconloader->iconPath("1rightarrow", KIcon::Small );
@@ -109,6 +116,26 @@ QString KonqAboutPageFactory::launch()
else
res = res.arg( "" );
+ // Try to split page in three. If it succeeds, insert the default search into the middle part.
+ QStringList parts = QStringList::split( "", res );
+ if ( parts.count() == 3 ) {
+ KConfig config( "kuriikwsfilterrc", true /*read-only*/, false /*no KDE globals*/ );
+ config.setGroup( "General" );
+ QString name = config.readEntry("DefaultSearchEngine");
+ KService::Ptr service =
+ KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(name));
+ if ( service ) {
+ QString searchBar = parts[1];
+ searchBar = searchBar
+ .arg( iconSize ).arg( iconSize )
+ .arg( service->name() )
+ .arg( service->property("Keys").toStringList()[0] )
+ ;
+ res = parts[0] + searchBar + parts[2];
+ }
+ else res = parts[0] + parts[2];
+ }
+
res = res.arg( i18n("Conquer your Desktop!") )
.arg( i18n( "Konqueror" ) )
.arg( i18n("Conquer your Desktop!") )
@@ -139,10 +166,10 @@ QString KonqAboutPageFactory::launch()
.arg(iconSize).arg(iconSize)
.arg( i18n( "Applications" ) )
.arg( i18n( "Installed programs" ) )
- .arg( settings_icon_path )
+ .arg( help_icon_path )
.arg(iconSize).arg(iconSize)
- .arg( i18n( "Settings" ) )
- .arg( i18n( "Desktop configuration" ) )
+ .arg( i18n( "About Kubuntu" ) )
+ .arg( i18n( "Kubuntu Documentation" ) )
.arg( continue_icon_path )
.arg( KIcon::SizeSmall ).arg( KIcon::SizeSmall )
.arg( i18n( "Next: An Introduction to Konqueror" ) )
@@ -422,10 +449,23 @@ KonqAboutPage::~KonqAboutPage()
bool KonqAboutPage::openURL( const KURL &u )
{
- if (u.url() == "about:plugins")
- serve( KonqAboutPageFactory::plugins(), "plugins" );
- else serve( KonqAboutPageFactory::launch(), "konqueror" );
- return true;
+ kdDebug(1202) << "now in KonqAboutPage::openURL( \"" << u.url() << "\" )" << endl;
+ if ( u.url() == "about:plugins" )
+ serve( KonqAboutPageFactory::plugins(), "plugins" );
+ else if ( !u.query().isEmpty() ) {
+ QMap< QString, QString > queryItems = u.queryItems( 0 );
+ QMap< QString, QString >::ConstIterator query = queryItems.begin();
+ QString newUrl;
+ if (query.key() == "strigi") {
+ newUrl = KURIFilter::self()->filteredURI( query.key() + ":?q=" + query.data() );
+ } else {
+ newUrl = KURIFilter::self()->filteredURI( query.key() + ":" + query.data() );
+ }
+ kdDebug(1202) << "scheduleRedirection( 0, \"" << newUrl << "\" )" << endl;
+ scheduleRedirection( 0, newUrl );
+ }
+ else serve( KonqAboutPageFactory::launch(), "konqueror" );
+ return true;
}
bool KonqAboutPage::openFile()
diff --git a/konqueror/about/launch.html b/konqueror/about/launch.html
index 80ad01eaa..9acc5d6a9 100644
--- a/konqueror/about/launch.html
+++ b/konqueror/about/launch.html
@@ -60,6 +60,20 @@
diff --git a/konqueror/iconview/konq_iconview.desktop b/konqueror/iconview/konq_iconview.desktop
index 2d355b771..8f85b9146 100644
--- a/konqueror/iconview/konq_iconview.desktop
+++ b/konqueror/iconview/konq_iconview.desktop
@@ -85,8 +85,5 @@ X-KDE-Library=konq_iconview
X-KDE-BrowserView-AllowAsDefault=true
X-KDE-BrowserView-HideFromMenus=true
X-KDE-BrowserView-Args=IconView
-X-KDE-BrowserView-ModeProperty=viewMode
-X-KDE-BrowserView-ModePropertyValue=IconView
-X-KDE-BrowserView-Built-Into=konqueror
Icon=view_icon
InitialPreference=10
diff --git a/konqueror/iconview/konq_multicolumnview.desktop b/konqueror/iconview/konq_multicolumnview.desktop
index 94b6c7288..2b3e55dd9 100644
--- a/konqueror/iconview/konq_multicolumnview.desktop
+++ b/konqueror/iconview/konq_multicolumnview.desktop
@@ -85,8 +85,5 @@ X-KDE-Library=konq_iconview
X-KDE-BrowserView-AllowAsDefault=true
X-KDE-BrowserView-HideFromMenus=true
X-KDE-BrowserView-Args=MultiColumnView
-X-KDE-BrowserView-ModeProperty=viewMode
-X-KDE-BrowserView-ModePropertyValue=MultiColumnView
-X-KDE-BrowserView-Built-Into=konqueror
Icon=view_multicolumn
InitialPreference=9
diff --git a/konqueror/konq_combo.cc b/konqueror/konq_combo.cc
index 2e5279474..4ea68abb3 100644
--- a/konqueror/konq_combo.cc
+++ b/konqueror/konq_combo.cc
@@ -204,6 +204,7 @@ void KonqCombo::removeDuplicates( int index )
if ( item == url )
removeItem( i );
}
+ lineEdit()->setCursorPosition( 0 );
}
// called via DCOP in all instances
diff --git a/konqueror/konq_mainwindow.cc b/konqueror/konq_mainwindow.cc
index 071c7e0be..e2e516b39 100644
--- a/konqueror/konq_mainwindow.cc
+++ b/konqueror/konq_mainwindow.cc
@@ -563,7 +563,7 @@ void KonqMainWindow::openURL( KonqView *_view, const KURL &_url,
kdDebug(1202) << "trying openView for " << url << " (serviceType " << serviceType << ")" << endl;
if ( ( !serviceType.isEmpty() && serviceType != "application/octet-stream") ||
- url.url() == "about:konqueror" || url.url() == "about:plugins" )
+ url.url().startsWith("about:konqueror") || url.url() == "about:plugins" )
{
KService::Ptr offer = KServiceTypeProfile::preferredService(serviceType, "Application");
// If the associated app is konqueror itself, then make sure we try to embed before bailing out.
@@ -731,7 +731,7 @@ bool KonqMainWindow::openView( QString serviceType, const KURL &_url, KonqView *
QString serviceName; // default: none provided
- if ( url.url() == "about:konqueror" || url.url() == "about:plugins" )
+ if ( url.url().startsWith("about:konqueror") || url.url() == "about:plugins" )
{
serviceType = "KonqAboutPage"; // not KParts/ReadOnlyPart, it fills the Location menu ! :)
serviceName = "konq_aboutpage";
@@ -1772,6 +1772,34 @@ void KonqMainWindow::slotReload( KonqView* reloadView )
}
}
+void KonqMainWindow::slotReloadStop() {
+ if (m_paReloadStop->icon() == "reload") {
+ slotReload();
+ toggleReloadStopButton(true);
+ } else {
+ slotStop();
+ toggleReloadStopButton(false);
+ }
+}
+
+void KonqMainWindow::toggleReloadStopButton(bool isReload) {
+ //m_paStop = new KAction( i18n( "&Stop" ), "stop", Key_Escape, this, SLOT( slotStop() ), actionCollection(), "stop" );
+ if (isReload) {
+ m_paReloadStop->setIcon("stop");
+ m_paReloadStop->setWhatsThis( i18n( "Stop loading the document
"
+ "All network transfers will be stopped and Konqueror will display the content "
+ "that has been received so far." ) );
+ m_paReloadStop->setToolTip( i18n( "Stop loading the document" ) );
+ //m_paReloadStop = new KAction( i18n( "&Reload" ), "reload", reloadShortcut, this, SLOT( slotReloadStop() ), actionCollection(), "reload" );
+ } else {
+ m_paReloadStop->setIcon("reload");
+ m_paReloadStop->setWhatsThis( i18n( "Reload the currently displayed document
"
+ "This may, for example, be needed to refresh webpages that have been "
+ "modified since they were loaded, in order to make the changes visible." ) );
+ m_paReloadStop->setToolTip( i18n( "Reload the currently displayed document" ) );
+ }
+}
+
void KonqMainWindow::slotReloadPopup()
{
if (m_pWorkingTab)
@@ -2196,7 +2224,7 @@ void KonqMainWindow::slotPartActivated( KParts::Part *part )
KService::Ptr serv = KService::serviceByDesktopName( ittb.current()->name() );
if ( serv && viewModeActionKey( serv ) == currentServiceLibrary ) {
KToggleAction* ta = static_cast( ittb.current() );
- ta->setChecked( true );
+ ta->setChecked( false );
QString servicename = m_currentView->service()->genericName();
if (servicename.isEmpty())
servicename = m_currentView->service()->name();
@@ -3664,6 +3692,7 @@ void KonqMainWindow::startAnimation()
//kdDebug(1202) << "KonqMainWindow::startAnimation" << endl;
m_paAnimatedLogo->start();
m_paStop->setEnabled( true );
+ toggleReloadStopButton( true );
}
void KonqMainWindow::stopAnimation()
@@ -3671,6 +3700,7 @@ void KonqMainWindow::stopAnimation()
//kdDebug(1202) << "KonqMainWindow::stopAnimation" << endl;
m_paAnimatedLogo->stop();
m_paStop->setEnabled( false );
+ toggleReloadStopButton( false );
}
void KonqMainWindow::setUpEnabled( const KURL &url )
@@ -3833,6 +3863,8 @@ void KonqMainWindow::initActions()
reloadShortcut.append(KKey(CTRL + Key_R));
m_paReload = new KAction( i18n( "&Reload" ), "reload", reloadShortcut, this, SLOT( slotReload() ), actionCollection(), "reload" );
m_paReloadAllTabs = new KAction( i18n( "&Reload All Tabs" ), "reload_all_tabs", SHIFT+Key_F5, this, SLOT( slotReloadAllTabs() ), actionCollection(), "reload_all_tabs" );
+
+ m_paReloadStop = new KAction( i18n( "&Reload/Stop" ), "reload", 0, this, SLOT( slotReloadStop() ), actionCollection(), "reload_stop" );
m_paUndo = KStdAction::undo( KonqUndoManager::self(), SLOT( undo() ), actionCollection(), "undo" );
//m_paUndo->setEnabled( KonqUndoManager::self()->undoAvailable() );
@@ -4067,6 +4099,7 @@ void KonqMainWindow::updateToolBarActions( bool pendingAction /*=false*/)
{
m_paAnimatedLogo->stop();
m_paStop->setEnabled( pendingAction ); //enable/disable based on any pending actions...
+ toggleReloadStopButton( pendingAction );
}
if ( m_currentView && m_currentView->url().isLocalFile() &&
@@ -4368,6 +4401,7 @@ void KonqMainWindow::enableAllActions( bool enable )
updateViewActions(); // undo, lock, link and other view-dependent actions
m_paStop->setEnabled( m_currentView && m_currentView->isLoading() );
+ toggleReloadStopButton( m_currentView && m_currentView->isLoading() );
if (m_toggleViewGUIClient)
{
@@ -5089,7 +5123,6 @@ void KonqMainWindow::updateViewModeActions()
bool bIsCurrentView = (*it)->desktopEntryName() == m_currentView->service()->desktopEntryName();
if ( bIsCurrentView )
{
- (*mapIt)->setChecked( true );
action->setChecked( true );
}
diff --git a/konqueror/konq_mainwindow.h b/konqueror/konq_mainwindow.h
index a99c485bf..3dbba5658 100644
--- a/konqueror/konq_mainwindow.h
+++ b/konqueror/konq_mainwindow.h
@@ -313,6 +313,8 @@ public:
static bool isPreloaded() { return s_preloaded; }
static void setPreloadedWindow( KonqMainWindow* );
static KonqMainWindow* preloadedWindow() { return s_preloadedWindow; }
+
+ void toggleReloadStopButton(bool isStop);
QString currentTitle() const;
QString currentURL() const;
@@ -375,6 +377,7 @@ public slots:
void slotLinkView();
void slotReload( KonqView* view = 0L );
void slotStop();
+ void slotReloadStop();
// Go menu
void slotUp();
@@ -649,6 +652,8 @@ private:
KAction *m_paStop;
KAction *m_paRename;
+ KAction *m_paReloadStop;
+
KAction *m_paTrash;
KAction *m_paDelete;
diff --git a/konqueror/listview/konq_detailedlistview.desktop b/konqueror/listview/konq_detailedlistview.desktop
index 9dc4938bd..ceb220194 100644
--- a/konqueror/listview/konq_detailedlistview.desktop
+++ b/konqueror/listview/konq_detailedlistview.desktop
@@ -84,6 +84,5 @@ ServiceTypes=KParts/ReadOnlyPart,Browser/View
X-KDE-Library=konq_listview
X-KDE-BrowserView-Args=DetailedList
X-KDE-BrowserView-HideFromMenus=true
-X-KDE-BrowserView-Built-Into=konqueror
Icon=view_detailed
InitialPreference=7
diff --git a/konqueror/listview/konq_infolistview.desktop b/konqueror/listview/konq_infolistview.desktop
index 12186d8f7..bee857315 100644
--- a/konqueror/listview/konq_infolistview.desktop
+++ b/konqueror/listview/konq_infolistview.desktop
@@ -82,6 +82,5 @@ ServiceTypes=KParts/ReadOnlyPart,Browser/View
X-KDE-Library=konq_listview
X-KDE-BrowserView-Args=InfoListView
X-KDE-BrowserView-HideFromMenus=true
-X-KDE-BrowserView-Built-Into=konqueror
Icon=view_detailed
InitialPreference=7
diff --git a/konqueror/listview/konq_listviewwidget.cc b/konqueror/listview/konq_listviewwidget.cc
index f3016b433..7d9231758 100644
--- a/konqueror/listview/konq_listviewwidget.cc
+++ b/konqueror/listview/konq_listviewwidget.cc
@@ -33,6 +33,7 @@
#include
#include
#include
+#include
#include
#include
@@ -405,9 +406,11 @@ void KonqBaseListViewWidget::contentsMousePressEvent( QMouseEvent *e )
{
if ( m_rubber )
{
- drawRubber();
- delete m_rubber;
- m_rubber = 0;
+
+ QRect r( m_rubber->normalize() );
+ delete m_rubber;
+ m_rubber = 0;
+ repaintContents( r, FALSE );
}
delete m_selected;
@@ -417,14 +420,15 @@ void KonqBaseListViewWidget::contentsMousePressEvent( QMouseEvent *e )
KonqBaseListViewItem* item = isExecuteArea( vp ) ?
static_cast( itemAt( vp ) ) : 0L;
- if ( item )
+ if ( item ) {
KListView::contentsMousePressEvent( e );
+ }
else {
if ( e->button() == LeftButton )
{
- if ( !( e->state() & ControlButton ) )
- setSelected( itemAt( vp ), false );
m_rubber = new QRect( e->x(), e->y(), 0, 0 );
+ clearSelection();
+ emit selectionChanged();
m_fileTip->setItem( 0 );
}
if ( e->button() != RightButton )
@@ -440,9 +444,11 @@ void KonqBaseListViewWidget::contentsMouseReleaseEvent( QMouseEvent *e )
{
if ( m_rubber )
{
- drawRubber();
+
+ QRect r( m_rubber->normalize() );
delete m_rubber;
m_rubber = 0;
+ repaintContents( r, FALSE );
}
if ( m_scrollTimer )
@@ -534,23 +540,21 @@ void KonqBaseListViewWidget::leaveEvent( QEvent *e )
KListView::leaveEvent( e );
}
-void KonqBaseListViewWidget::drawRubber()
+void KonqBaseListViewWidget::drawRubber( QPainter *p )
{
if ( !m_rubber )
return;
- QPainter p;
- p.begin( viewport() );
- p.setRasterOp( NotROP );
- p.setPen( QPen( color0, 1 ) );
- p.setBrush( NoBrush );
+ p->setRasterOp( NotROP );
+ p->setPen( QPen( color0, 1 ) );
+ p->setBrush( NoBrush );
QPoint pt( m_rubber->x(), m_rubber->y() );
pt = contentsToViewport( pt );
- style().drawPrimitive( QStyle::PE_FocusRect, &p,
+ style().drawPrimitive( QStyle::PE_RubberBand, p,
QRect( pt.x(), pt.y(), m_rubber->width(), m_rubber->height() ),
colorGroup(), QStyle::Style_Default, colorGroup().base() );
- p.end();
+
}
void KonqBaseListViewWidget::slotAutoScroll()
@@ -566,10 +570,12 @@ void KonqBaseListViewWidget::slotAutoScroll()
if ( vc == m_rubber->bottomRight() )
return;
+ QRect oldRubber = *m_rubber;
+
const int oldTop = m_rubber->normalize().top();
const int oldBottom = m_rubber->normalize().bottom();
- drawRubber();
+
m_rubber->setBottomRight( vc );
QListViewItem *cur = itemAt( QPoint(0,0) );
@@ -577,12 +583,20 @@ void KonqBaseListViewWidget::slotAutoScroll()
bool block = signalsBlocked();
blockSignals( true );
+ QRect rr;
QRect nr = m_rubber->normalize();
+ bool changed = FALSE;
+
if ( cur )
{
- QRect rect = itemRect( cur );
- if ( !allColumnsShowFocus() )
+ QRect rect;
+ if ( allColumnsShowFocus() )
+ rect = itemRect( cur );
+ else {
+ rect = itemRect( cur );
rect.setWidth( executeArea( cur ) );
+ }
+
rect = QRect( viewportToContents( rect.topLeft() ),
viewportToContents( rect.bottomRight() ) );
@@ -606,9 +620,26 @@ void KonqBaseListViewWidget::slotAutoScroll()
if ( rect.intersects( nr ) )
{
if ( !cur->isSelected() && cur->isSelectable() )
+ {
setSelected( cur, true );
- } else if ( !m_selected || !m_selected->contains( (KonqBaseListViewItem*)cur ) )
- setSelected( cur, false );
+ changed = TRUE;
+ rr = rr.unite( itemRect( cur ) );
+ }
+ }
+ else
+ {
+ if ( cur->isSelected() )
+ {
+ changed = TRUE;
+ rr = rr.unite( itemRect( cur ) );
+ }
+
+ if ( !m_selected || !m_selected->contains( (KonqBaseListViewItem*)cur ) )
+ {
+ setSelected( cur, false );
+ }
+ }
+
cur = cur->itemBelow();
if (cur && !allColumnsShowFocus())
@@ -625,9 +656,26 @@ void KonqBaseListViewWidget::slotAutoScroll()
if ( rect.intersects( nr ) )
{
if ( !cur->isSelected() && cur->isSelectable() )
+ {
setSelected( cur, true );
- } else if ( !m_selected || !m_selected->contains( (KonqBaseListViewItem*)cur ) )
- setSelected( cur, false );
+ changed = TRUE;
+ rr = rr.unite( itemRect( cur ) );
+ }
+ }
+ else
+ {
+ if ( cur->isSelected() )
+ {
+ changed = TRUE;
+ rr = rr.unite( itemRect( cur ) );
+ }
+
+ if ( !m_selected || !m_selected->contains( (KonqBaseListViewItem*)cur ) )
+ {
+ setSelected( cur, false );
+ }
+ }
+
cur = cur->itemAbove();
if (cur && !allColumnsShowFocus())
@@ -639,7 +687,31 @@ void KonqBaseListViewWidget::slotAutoScroll()
blockSignals( block );
emit selectionChanged();
- drawRubber();
+ QRect allRect = oldRubber.normalize();
+ if ( changed )
+ {
+ allRect |= rr.normalize();
+ }
+ allRect |= m_rubber->normalize();
+ QPoint point = contentsToViewport( allRect.topLeft() );
+ allRect = QRect( point.x(), point.y(), allRect.width(), allRect.height() );
+ allRect &= viewport()->rect();
+ allRect.addCoords( -2, -2, 2, 2 );
+
+ QPixmap backrubber( viewport()->rect().size() );
+ backrubber.fill( viewport(), viewport()->rect().topLeft() );
+
+ QPainter p( &backrubber );
+ p.save();
+ drawContentsOffset( &p,
+ contentsX(),
+ contentsY(),
+ contentsX() + allRect.left(), contentsY() + allRect.top(),
+ allRect.width(), allRect.height() );
+ p.restore();
+ drawRubber( &p );
+ p.end();
+ bitBlt( viewport(), allRect.topLeft(), &backrubber, allRect );
const int scroll_margin = 40;
ensureVisible( vc.x(), vc.y(), scroll_margin, scroll_margin );
@@ -669,9 +741,12 @@ void KonqBaseListViewWidget::slotAutoScroll()
void KonqBaseListViewWidget::viewportPaintEvent( QPaintEvent *e )
{
- drawRubber();
+
KListView::viewportPaintEvent( e );
- drawRubber();
+
+ QPainter p( viewport() );
+ drawRubber( &p );
+ p.end();
}
void KonqBaseListViewWidget::viewportResizeEvent(QResizeEvent * e)
@@ -904,7 +979,42 @@ void KonqBaseListViewWidget::slotReturnPressed( QListViewItem *_item )
url.cleanPath();
bool isIntoTrash = url.isLocalFile() && url.path(1).startsWith(KGlobalSettings::trashPath());
if ( !isIntoTrash || (isIntoTrash && fileItem->isDir()) )
- m_pBrowserView->lmbClicked( fileItem );
+ {
+ m_pBrowserView->lmbClicked( fileItem );
+
+ if (_item->pixmap(0) != 0)
+ {
+ // Rect of the QListViewItem's pixmap area.
+ QRect rect = _item->listView()->itemRect(_item);
+
+ // calculate nesting depth
+ int nestingDepth = 0;
+ for (QListViewItem *currentItem = _item->parent();
+ currentItem != 0;
+ currentItem = currentItem->parent())
+ nestingDepth++;
+
+ // no parent no indent
+ if (_item->parent() == 0)
+ nestingDepth = 0;
+
+ // Root decoration means additional indent
+ if (_item->listView()->rootIsDecorated())
+ nestingDepth++;
+
+ // set recalculated rect
+ rect.setLeft(_item->listView()->itemMargin() + _item->listView()->treeStepSize() * nestingDepth);
+ rect.setWidth(_item->pixmap(0)->width());
+
+ // gather pixmap
+ QPixmap *pix = new QPixmap(*(_item->pixmap(0)));
+
+ // call the icon effect
+ KIconEffect::visualActivate(viewport(), rect, pix);
+
+ delete(pix);
+ }
+ }
else
KMessageBox::information( 0, i18n("You must take the file out of the trash before being able to use it.") );
}
diff --git a/konqueror/listview/konq_listviewwidget.h b/konqueror/listview/konq_listviewwidget.h
index bc4161862..d6451e50d 100644
--- a/konqueror/listview/konq_listviewwidget.h
+++ b/konqueror/listview/konq_listviewwidget.h
@@ -206,7 +206,7 @@ protected:
virtual void viewportPaintEvent( QPaintEvent *e );
virtual void viewportResizeEvent( QResizeEvent *e );
- virtual void drawRubber();
+ virtual void drawRubber( QPainter * );
virtual void contentsMousePressEvent( QMouseEvent *e );
virtual void contentsMouseReleaseEvent( QMouseEvent *e );
virtual void contentsMouseMoveEvent( QMouseEvent *e );
@@ -246,7 +246,8 @@ protected:
QColor m_itemColor;
QRect *m_rubber;
-
+ QPixmap *m_backrubber;
+
bool m_bTopLevelComplete:1;
bool m_showIcons:1;
bool m_bCaseInsensitive:1;
diff --git a/konqueror/listview/konq_textview.desktop b/konqueror/listview/konq_textview.desktop
index f5d4e5c98..1a88b242b 100644
--- a/konqueror/listview/konq_textview.desktop
+++ b/konqueror/listview/konq_textview.desktop
@@ -85,6 +85,5 @@ ServiceTypes=Browser/View
X-KDE-Library=konq_listview
X-KDE-BrowserView-Args=TextView
X-KDE-BrowserView-HideFromMenus=true
-X-KDE-BrowserView-Built-Into=konqueror
Icon=view_text
InitialPreference=6
diff --git a/konqueror/listview/konq_treeview.desktop b/konqueror/listview/konq_treeview.desktop
index 3fcce32db..3f9f0890c 100644
--- a/konqueror/listview/konq_treeview.desktop
+++ b/konqueror/listview/konq_treeview.desktop
@@ -85,6 +85,5 @@ X-KDE-Library=konq_listview
X-KDE-BrowserView-Args=MixedTree
X-KDE-BrowserView-HideFromMenus=true
X-KDE-BrowserView-HierarchicalView=true
-X-KDE-BrowserView-Built-Into=konqueror
Icon=view_tree
InitialPreference=8
diff --git a/konqueror/sidebar/trees/dirtree_module/dirtree_item.cpp b/konqueror/sidebar/trees/dirtree_module/dirtree_item.cpp
index 78132010a..7f7ee8849 100644
--- a/konqueror/sidebar/trees/dirtree_module/dirtree_item.cpp
+++ b/konqueror/sidebar/trees/dirtree_module/dirtree_item.cpp
@@ -105,7 +105,7 @@ bool KonqSidebarDirTreeItem::hasStandardIcon()
{
// The reason why we can't use KFileItem::iconName() is that it doesn't
// take custom icons in .directory files into account
- return m_fileItem->determineMimeType()->icon( m_fileItem->url(), m_fileItem->isLocalFile() ) == "folder";
+ return m_fileItem->iconName() == "folder";
}
void KonqSidebarDirTreeItem::paintCell( QPainter *_painter, const QColorGroup & _cg, int _column, int _width, int _alignment )
diff --git a/konsole/konsole/TEHistory.cpp b/konsole/konsole/TEHistory.cpp
index 5a0ee5477..a24635acb 100644
--- a/konsole/konsole/TEHistory.cpp
+++ b/konsole/konsole/TEHistory.cpp
@@ -207,23 +207,24 @@ void HistoryScrollFile::addLine(bool previousWrapped)
// History Scroll Buffer //////////////////////////////////////
HistoryScrollBuffer::HistoryScrollBuffer(unsigned int maxNbLines)
: HistoryScroll(new HistoryTypeBuffer(maxNbLines)),
- m_histBuffer(maxNbLines),
- m_wrappedLine(maxNbLines),
m_maxNbLines(maxNbLines),
m_nbLines(0),
- m_arrayIndex(maxNbLines - 1)
+ m_arrayIndex(0),
+ m_buffFilled(false)
{
+ m_histBuffer.setAutoDelete(true);
+ m_histBuffer.resize(maxNbLines);
+ m_wrappedLine.resize(maxNbLines);
}
HistoryScrollBuffer::~HistoryScrollBuffer()
{
- for(size_t line = 0; line < m_nbLines; ++line) {
- delete m_histBuffer[adjustLineNb(line)];
- }
}
void HistoryScrollBuffer::addCells(ca a[], int count)
{
+ //unsigned int nbLines = countLines(bytes, len);
+
histline* newLine = new histline;
newLine->duplicate(a, count);
@@ -231,15 +232,45 @@ void HistoryScrollBuffer::addCells(ca a[], int count)
++m_arrayIndex;
if (m_arrayIndex >= m_maxNbLines) {
m_arrayIndex = 0;
- }
+ m_buffFilled = true;
+ }
- if (m_nbLines < m_maxNbLines) ++m_nbLines;
+ // FIXME: See BR96605
+ if (m_nbLines < m_maxNbLines - 1) ++m_nbLines;
- delete m_histBuffer[m_arrayIndex];
+ // m_histBuffer.remove(m_arrayIndex); // not necessary
m_histBuffer.insert(m_arrayIndex, newLine);
m_wrappedLine.clearBit(m_arrayIndex);
}
+void HistoryScrollBuffer::normalize()
+{
+ if (!m_buffFilled || !m_arrayIndex) return;
+ QPtrVector newHistBuffer;
+ newHistBuffer.resize(m_maxNbLines);
+ QBitArray newWrappedLine;
+ newWrappedLine.resize(m_maxNbLines);
+ for(int i = 0; i < (int) m_maxNbLines-2; i++)
+ {
+ int lineno = adjustLineNb(i);
+ newHistBuffer.insert(i+1, m_histBuffer[lineno]);
+ newWrappedLine.setBit(i+1, m_wrappedLine[lineno]);
+ }
+ m_histBuffer.setAutoDelete(false);
+ // Qt 2.3: QVector copy assignment is buggy :-(
+ // m_histBuffer = newHistBuffer;
+ for(int i = 0; i < (int) m_maxNbLines; i++)
+ {
+ m_histBuffer.insert(i, newHistBuffer[i]);
+ m_wrappedLine.setBit(i, newWrappedLine[i]);
+ }
+ m_histBuffer.setAutoDelete(true);
+
+ m_arrayIndex = m_maxNbLines;
+ m_buffFilled = false;
+ m_nbLines = m_maxNbLines-2;
+}
+
void HistoryScrollBuffer::addLine(bool previousWrapped)
{
m_wrappedLine.setBit(m_arrayIndex,previousWrapped);
@@ -284,40 +315,19 @@ void HistoryScrollBuffer::getCells(int lineno, int colno, int count, ca res[])
return;
}
- assert(colno <= (int) l->size() - count);
+ assert((colno < (int) l->size()) || (count == 0));
memcpy(res, l->data() + colno, count * sizeof(ca));
}
void HistoryScrollBuffer::setMaxNbLines(unsigned int nbLines)
{
- QPtrVector newHistBuffer(nbLines);
- QBitArray newWrappedLine(nbLines);
-
- size_t preservedLines = (nbLines > m_nbLines ? m_nbLines : nbLines); //min
-
- // delete any lines that will be lost
- size_t lineOld;
- for(lineOld = 0; lineOld < m_nbLines - preservedLines; ++lineOld) {
- delete m_histBuffer[adjustLineNb(lineOld)];
- }
-
- // copy the lines to new arrays
- size_t indexNew = 0;
- while(indexNew < preservedLines) {
- newHistBuffer.insert(indexNew, m_histBuffer[adjustLineNb(lineOld)]);
- newWrappedLine.setBit(indexNew, m_wrappedLine[adjustLineNb(lineOld)]);
- ++lineOld;
- ++indexNew;
- }
- m_arrayIndex = preservedLines - 1;
-
- m_histBuffer = newHistBuffer;
- m_wrappedLine = newWrappedLine;
-
+ normalize();
m_maxNbLines = nbLines;
- if (m_nbLines > m_maxNbLines)
- m_nbLines = m_maxNbLines;
+ m_histBuffer.resize(m_maxNbLines);
+ m_wrappedLine.resize(m_maxNbLines);
+ if (m_nbLines > m_maxNbLines - 2)
+ m_nbLines = m_maxNbLines -2;
delete m_histType;
m_histType = new HistoryTypeBuffer(nbLines);
@@ -325,10 +335,10 @@ void HistoryScrollBuffer::setMaxNbLines(unsigned int nbLines)
int HistoryScrollBuffer::adjustLineNb(int lineno)
{
- // lineno = 0: oldest line
- // lineno = getLines() - 1: newest line
-
- return (m_arrayIndex + lineno - (m_nbLines - 1) + m_maxNbLines) % m_maxNbLines;
+ if (m_buffFilled)
+ return (lineno + m_arrayIndex + 2) % m_maxNbLines;
+ else
+ return lineno ? lineno + 1 : 0;
}
diff --git a/konsole/konsole/TEHistory.h b/konsole/konsole/TEHistory.h
index c8fa2f379..446611e0a 100644
--- a/konsole/konsole/TEHistory.h
+++ b/konsole/konsole/TEHistory.h
@@ -142,11 +142,16 @@ public:
private:
int adjustLineNb(int lineno);
+ // Normalize buffer so that the size can be changed.
+ void normalize();
+
+ bool m_hasScroll;
QPtrVector m_histBuffer;
QBitArray m_wrappedLine;
unsigned int m_maxNbLines;
unsigned int m_nbLines;
unsigned int m_arrayIndex;
+ bool m_buffFilled;
};
diff --git a/konsole/konsole/TEPty.h b/konsole/konsole/TEPty.h
index 294fde8c7..1597d44d8 100644
--- a/konsole/konsole/TEPty.h
+++ b/konsole/konsole/TEPty.h
@@ -39,6 +39,13 @@ Q_OBJECT
~TEPty();
public:
+ bool setPtyFd(int p) {
+ bool res = pty()->setPty(p);
+ setupCommunication((Communication)(Stdin|Stdout));
+ commSetupDoneP();
+ runs = true;
+ return res;
+ };
/*!
* having a `run' separate from the constructor allows to make
diff --git a/konsole/konsole/keytrans.cpp b/konsole/konsole/keytrans.cpp
index 7632520ba..f0c8311a7 100644
--- a/konsole/konsole/keytrans.cpp
+++ b/konsole/konsole/keytrans.cpp
@@ -140,10 +140,10 @@ bool KeyTrans::findEntry(int key, int bits, int* cmd, const char** txt, int* len
if ((*cmd==CMD_send) && it.current()->anymodspecified() && (*len < 16))
{
static char buf[16];
- char *c, mask = '1' + BITS(0, bits&(1<txt.ascii());
- c = strchr(buf, '*');
+ c = (char*)strchr(buf, '*');
if (c) *c = mask;
*txt = buf;
}
diff --git a/konsole/konsole/konsole.cpp b/konsole/konsole/konsole.cpp
index 2f9abdf52..2b85b6f39 100644
--- a/konsole/konsole/konsole.cpp
+++ b/konsole/konsole/konsole.cpp
@@ -3345,8 +3345,8 @@ void Konsole::addSessionCommand(const QString &path)
// try to locate the binary
QString exec= co->readPathEntry("Exec");
- if (exec.startsWith("su -c \'")) {
- exec = exec.mid(7,exec.length()-8);
+ if (exec.startsWith("sudo su -c \'")) {
+ exec = exec.mid(12,exec.length()-13);
}
exec = KRun::binaryName(exec, false);
diff --git a/konsole/konsole/konsole_part.cpp b/konsole/konsole/konsole_part.cpp
index bfb183935..68ca36024 100644
--- a/konsole/konsole/konsole_part.cpp
+++ b/konsole/konsole/konsole_part.cpp
@@ -1064,6 +1064,16 @@ void konsolePart::startProgram( const QString& program,
se->run();
}
+bool konsolePart::setPtyFd( int master_pty )
+{
+ kdDebug(1211) << "konsolePart::setPtyFd " << master_pty << endl;
+ TEPty *pty = new TEPty();
+ pty->setPtyFd(master_pty);
+ if ( !se )
+ newSession();
+ se->setPty(pty);
+}
+
void konsolePart::newSession()
{
if ( se ) delete se;
diff --git a/konsole/konsole/konsole_part.h b/konsole/konsole/konsole_part.h
index 6f410d3c3..5cff68c4e 100644
--- a/konsole/konsole/konsole_part.h
+++ b/konsole/konsole/konsole_part.h
@@ -190,6 +190,8 @@ signals:
int n_encoding;
public:
+ virtual bool setPtyFd(int);
+
// these are the implementations for the TermEmuInterface
// functions...
void startProgram( const QString& program,
diff --git a/konsole/konsole/konsole_wcwidth.cpp b/konsole/konsole/konsole_wcwidth.cpp
index eeb82f4a2..1592e2de3 100644
--- a/konsole/konsole/konsole_wcwidth.cpp
+++ b/konsole/konsole/konsole_wcwidth.cpp
@@ -9,6 +9,10 @@
#include "konsole_wcwidth.h"
+#include // for getenv()
+
+
+
struct interval {
unsigned short first;
unsigned short last;
@@ -65,7 +69,7 @@ static int bisearch(Q_UINT16 ucs, const struct interval *table, int max) {
* in ISO 10646.
*/
-int konsole_wcwidth(Q_UINT16 ucs)
+int konsole_wcwidth_normal(Q_UINT16 ucs)
{
/* sorted list of non-overlapping intervals of non-spacing characters */
static const struct interval combining[] = {
@@ -131,7 +135,6 @@ int konsole_wcwidth(Q_UINT16 ucs)
(ucs >= 0x20000 && ucs <= 0x2ffff) */));
}
-#if 0
/*
* The following function is the same as konsole_wcwidth(), except that
* spacing characters in the East Asian Ambiguous (A) category as
@@ -202,15 +205,31 @@ int konsole_wcwidth_cjk(Q_UINT16 ucs)
sizeof(ambiguous) / sizeof(struct interval) - 1))
return 2;
- return konsole_wcwidth(ucs);
+ return konsole_wcwidth_normal(ucs);
}
-#endif
// single byte char: +1, multi byte char: +2
int string_width( const QString &txt )
{
int w = 0;
- for ( uint i = 0; i < txt.length(); ++i )
- w += konsole_wcwidth( txt[ i ].unicode() );
+
+ for ( uint i = 1; i < txt.length(); ++i ) {
+ w += konsole_wcwidth(txt[i].unicode());
+ }
return w;
}
+
+
+int konsole_wcwidth(Q_UINT16 ucs) {
+
+ static int use_wcwidth_cjk = (getenv("KONSOLE_WCWIDTH_CJK")) ? 1: 0;
+
+ if (use_wcwidth_cjk) {
+ return konsole_wcwidth_cjk(ucs);
+ } else {
+ return konsole_wcwidth_normal(ucs);
+ }
+
+}
+
+
diff --git a/konsole/konsole/konsole_wcwidth.h b/konsole/konsole/konsole_wcwidth.h
index 274fc5b7d..15f6ef9a8 100644
--- a/konsole/konsole/konsole_wcwidth.h
+++ b/konsole/konsole/konsole_wcwidth.h
@@ -10,9 +10,7 @@
#include
int konsole_wcwidth(Q_UINT16 ucs);
-#if 0
-int konsole_wcwidth_cjk(Q_UINT16 ucs);
-#endif
+//int konsole_wcwidth_cjk(Q_UINT16 ucs);
int string_width( const QString &txt );
diff --git a/konsole/other/su.desktop b/konsole/other/su.desktop
index 1a2b89844..5d7b5287e 100644
--- a/konsole/other/su.desktop
+++ b/konsole/other/su.desktop
@@ -123,7 +123,7 @@ Comment[vi]=Mở một Trình giao diện Gốc mới
Comment[wa]=Novea shell root
Comment[zh_CN]=新建 Root Shell
Comment[zh_TW]=新增 Root Shell
-Exec=su -
+Exec=sudo su -
Schema=BlackOnLightYellow.schema
#Schema=Linux.schema
#VGA
diff --git a/konsole/other/sumc.desktop b/konsole/other/sumc.desktop
index 04daff141..b8a6ef535 100644
--- a/konsole/other/sumc.desktop
+++ b/konsole/other/sumc.desktop
@@ -139,7 +139,7 @@ Comment[wa]=Novea «Midnight Commander» e môde root
Comment[zh_CN]=新建 Root Midnight Commander
Comment[zh_TW]=新增 Root Midnight Commander
Comment[zu]=Umyaleli Waphakathi nobusuku Wempande Entsha
-Exec=su -c 'mc -c'
+Exec=sudo su -c 'mc -c'
Schema=BlackOnLightYellow.schema
#VGA
#Font=6
diff --git a/ksmserver/Makefile.am b/ksmserver/Makefile.am
index 00ce998c8..62f9d8976 100644
--- a/ksmserver/Makefile.am
+++ b/ksmserver/Makefile.am
@@ -17,7 +17,7 @@
SUBDIRS = .
-INCLUDES= -I$(top_srcdir)/kdmlib $(all_includes)
+INCLUDES= -I$(top_srcdir)/kdmlib $(all_includes) $(HAL_INCS) $(DBUS_INCS)
bin_PROGRAMS =
lib_LTLIBRARIES =
@@ -31,7 +31,7 @@ ksmserver_la_SOURCES = main.cpp server.cpp shutdowndlg.cpp \
KSMServerInterface.skel server.skel
ksmserver_la_LDFLAGS = $(all_libraries) -avoid-version -module
-ksmserver_la_LIBADD = ../kdmlib/libdmctl.la $(LIB_KDEUI)
+ksmserver_la_LIBADD = ../kdmlib/libdmctl.la $(LIB_KDEUI) $(HAL_LIBS) $(DBUS_LIBS)
picsdir = $(kde_datadir)/ksmserver/pics
pics_DATA = shutdownkonq.png
@@ -44,7 +44,7 @@ updatedir = $(kde_datadir)/kconf_update
EXTRA_PROGRAMS = testsh
testsh_SOURCES = test.cpp
testsh_LDFLAGS = $(all_libraries) $(KDE_RPATH)
-testsh_LDADD = $(LIB_KDEUI) shutdowndlg.lo ../kdmlib/libdmctl.la
+testsh_LDADD = $(LIB_KDEUI) shutdowndlg.lo ../kdmlib/libdmctl.la $(HAL_LIBS) $(DBUS_LIBS)
messages:
$(XGETTEXT) *.cpp -o $(podir)/ksmserver.pot
diff --git a/ksmserver/legacy.cpp b/ksmserver/legacy.cpp
index ca198a212..464ded3d8 100644
--- a/ksmserver/legacy.cpp
+++ b/ksmserver/legacy.cpp
@@ -358,7 +358,7 @@ QString KSMServer::windowWmClientMachine(WId w)
hostnamebuf[sizeof(hostnamebuf)-1] = 0;
if (result == hostnamebuf)
result = "localhost";
- if(char *dot = strchr(hostnamebuf, '.')) {
+ if(char *dot = (char*)strchr(hostnamebuf, '.')) {
*dot = '\0';
if(result == hostnamebuf)
result = "localhost";
diff --git a/ksmserver/server.cpp b/ksmserver/server.cpp
index 2fcb83785..1bcdea9ac 100644
--- a/ksmserver/server.cpp
+++ b/ksmserver/server.cpp
@@ -366,12 +366,12 @@ Status SetAuthentication_local (int count, IceListenObj *listenObjs)
for (i = 0; i < count; i ++) {
char *prot = IceGetListenConnectionString(listenObjs[i]);
if (!prot) continue;
- char *host = strchr(prot, '/');
+ char *host = (char*)strchr(prot, '/');
char *sock = 0;
if (host) {
*host=0;
host++;
- sock = strchr(host, ':');
+ sock = (char*)strchr(host, ':');
if (sock) {
*sock = 0;
sock++;
diff --git a/ksmserver/shutdowndlg.cpp b/ksmserver/shutdowndlg.cpp
index 06bc03c4c..814736b96 100644
--- a/ksmserver/shutdowndlg.cpp
+++ b/ksmserver/shutdowndlg.cpp
@@ -20,15 +20,20 @@ Copyright (C) 2000 Matthias Ettrich
#include
#include
#include
+#include
#include
#include
#include
+#include
+#include
+#include
#include
#include
#include
#include
#include
+#include
#include
#include
#include
@@ -37,12 +42,19 @@ Copyright (C) 2000 Matthias Ettrich
#include
#include
#include
+#include
+
+#include
+#include
#include
#include
#include
#include
+#include
#include
+#include
+
#include
@@ -52,35 +64,195 @@ KSMShutdownFeedback * KSMShutdownFeedback::s_pSelf = 0L;
KSMShutdownFeedback::KSMShutdownFeedback()
: QWidget( 0L, "feedbackwidget", WType_Popup ),
- m_currentY( 0 )
+ m_currentY( 0 ),
+ m_grayOpacity( 0.0f ),
+ m_compensation( 0.0f ),
+ m_fadeBackwards( FALSE ),
+ m_unfadedImage(),
+ m_grayImage(),
+ m_fadeTime(),
+ m_pmio()
+
{
- setBackgroundMode( QWidget::NoBackground );
- setGeometry( QApplication::desktop()->geometry() );
- QTimer::singleShot( 10, this, SLOT( slotPaintEffect() ) );
- m_root.resize( width(), height() );
+ m_grayImage = QImage::QImage();
+ m_unfadedImage = QImage::QImage();
+ resize(0, 0);
+ setShown(true);
+ QTimer::singleShot( 500, this, SLOT( slotPaintEffect() ) );
}
+// called after stopping shutdown-feedback -> smooth fade-back to color-mode
+void KSMShutdownFeedback::fadeBack( void )
+{
+ m_fadeTime.restart();
+ m_fadeBackwards = TRUE;
+ // its possible that we have to fade back, before all is completely gray, so we cannot start
+ // with completely gray when fading back...
+ m_compensation = 1.0f - m_grayOpacity;
+ // wait until we're completely back in color-mode...
+ while ( m_grayOpacity > 0.0f )
+ slotPaintEffect();
+}
void KSMShutdownFeedback::slotPaintEffect()
{
- if ( m_currentY >= height() ) {
- if ( backgroundMode() == QWidget::NoBackground ) {
- setBackgroundMode( QWidget::NoBackground );
- setBackgroundPixmap( m_root );
- }
- return;
+ // determine which fade to use
+ if (KConfigGroup(KGlobal::config(), "Logout").readBoolEntry("doFancyLogout", true))
+ {
+
+ float doFancyLogoutAdditionalDarkness = (float)KConfigGroup(KGlobal::config(), "Logout").readDoubleNumEntry("doFancyLogoutAdditionalDarkness", 0.6);
+
+ float doFancyLogoutFadeTime = (float)KConfigGroup(KGlobal::config(), "Logout").readDoubleNumEntry("doFancyLogoutFadeTime", 4000);
+
+ float doFancyLogoutFadeBackTime = (float)KConfigGroup(KGlobal::config(), "Logout").readDoubleNumEntry("doFancyLogoutFadeBackTime", 1000);
+
+ // if slotPaintEffect() is called first time, we have to initialize the gray image
+ // we also could do that in the constructor, but then the displaying of the
+ // logout-UI would be too much delayed...
+ if ( m_grayImage.isNull() )
+ {
+ setBackgroundMode( QWidget::NoBackground );
+ setGeometry( QApplication::desktop()->geometry() );
+ m_root.resize( width(), height() ); // for the default logout
+
+ m_grayImage = QPixmap::grabWindow(qt_xrootwin(), 0, 0, QApplication::desktop()->width(), QApplication::desktop()->height()).convertToImage();
+ m_unfadedImage = m_grayImage.copy();
+ register uchar * r = m_grayImage.bits();
+ register uchar * g = m_grayImage.bits() + 1;
+ register uchar * b = m_grayImage.bits() + 2;
+ uchar * end = m_grayImage.bits() + m_grayImage.numBytes();
+
+ while ( r != end ) {
+ *r = *g = *b = (uchar) ( ( (*r)*11 + ((*g)<<4) + (*b)*5 ) * doFancyLogoutAdditionalDarkness / 32.0f );
+ r += 4;
+ g += 4;
+ b += 4;
+ }
+ // start timer which is used for cpu-speed-independent fading
+ m_fadeTime.start();
+ m_rowsDone = 0;
+ }
+
+ // return if fading is completely done...
+ if ( ( m_grayOpacity >= 1.0f && m_fadeBackwards == FALSE ) || ( m_grayOpacity <= 0.0f && m_fadeBackwards == TRUE ) )
+ return;
+
+
+ if ( m_fadeBackwards == FALSE )
+ {
+ m_grayOpacity = m_fadeTime.elapsed() / doFancyLogoutFadeTime;
+ if ( m_grayOpacity > 1.0f )
+ m_grayOpacity = 1.0f;
+ }
+ else
+ {
+ m_grayOpacity = 1.0f - m_fadeTime.elapsed() / doFancyLogoutFadeBackTime - m_compensation;
+ if ( m_grayOpacity < 0.0f )
+ m_grayOpacity = 0.0f;
+ }
+
+ const int imgWidth = m_unfadedImage.width();
+ int imgHeight = m_unfadedImage.height();
+ int heightUnit = imgHeight / 3;
+ if( heightUnit < 1 )
+ heightUnit = 1;
+
+ int y1 = static_cast( imgHeight*m_grayOpacity - heightUnit + m_grayOpacity*heightUnit*2.0f );
+ if( y1 > imgHeight )
+ y1 = imgHeight;
+
+ int y2 = y1+heightUnit;
+ if( y2 > imgHeight )
+ y2 = imgHeight;
+
+ if( m_fadeBackwards == FALSE )
+ {
+ if( y1 > 0 && y1 < imgHeight && y1-m_rowsDone > 0 && m_rowsDone < imgHeight )
+ {
+ QImage img( imgWidth, y1-m_rowsDone, 32 );
+ memcpy( img.bits(), m_grayImage.scanLine( m_rowsDone ), imgWidth*(y1-m_rowsDone)*4 );
+ // conversion is slow as hell if desktop-depth != 24bpp...
+ //Pixmap pm = m_pmio.convertToPixmap( img );
+ //bitBlt( this, 0, m_rowsDone, &pm );
+// QImage pm = m_pmio.convertToImage( img );
+ bitBlt( this, 0, m_rowsDone, &img );
+ m_rowsDone = y1;
+ }
+ }
+ else
+ {
+ // when fading back we have to blit area which isnt gray anymore to unfaded image
+ if( y2 > 0 && y2 < imgHeight && m_rowsDone > y2 )
+ {
+ QImage img( imgWidth, m_rowsDone-y2, 32 );
+ memcpy( img.bits(), m_unfadedImage.scanLine( y2 ), imgWidth*(m_rowsDone-y2)*4 );
+ // conversion is slow as hell if desktop-depth != 24bpp...
+ //QPixmap pm = m_pmio.convertToPixmap( img );
+ //bitBlt( this, 0, y2, &pm );
+ bitBlt( this, 0, y2, &img );
+ m_rowsDone = y2;
+ }
+ }
+
+ int start_y1 = y1;
+ if( start_y1 < 0 )
+ start_y1 = 0;
+ if( y2 > start_y1 )
+ {
+ QImage img( imgWidth, y2-start_y1, 32 );
+ memcpy( img.bits(), m_grayImage.scanLine( start_y1 ), ( y2-start_y1 ) * imgWidth * 4 );
+ register uchar * rs = m_unfadedImage.scanLine( start_y1 );
+ register uchar * gs = rs + 1;
+ register uchar * bs = gs + 1;
+ register uchar * rd = img.bits();
+ register uchar * gd = rd + 1;
+ register uchar * bd = gd + 1;
+ for( int y = start_y1; y < y2; ++y )
+ {
+ // linear gradients look bad, so use cos-function
+ short int opac = static_cast( 128 - cosf( M_PI*(y-y1)/heightUnit )*128.0f );
+ for( short int x = 0; x < imgWidth; ++x )
+ {
+ *rd += ( ( ( *rs - *rd ) * opac ) >> 8 );
+ rs += 4; rd += 4;
+ *gd += ( ( ( *gs - *gd ) * opac ) >> 8 );
+ gs += 4; gd += 4;
+ *bd += ( ( ( *bs - *bd ) * opac ) >> 8 );
+ bs += 4; bd += 4;
+ }
+ }
+ // conversion is slow as hell if desktop-depth != 24bpp...
+ //QPixmap pm = m_pmio.convertToPixmap( img );
+ //bitBlt( this, 0, start_y1, &pm );
+ bitBlt( this, 0, start_y1, &img );
+ }
+
+ QTimer::singleShot( 5, this, SLOT( slotPaintEffect() ) );
+
+ }
+ // standard logout fade
+ else
+ {
+ if ( m_currentY >= height() ) {
+ if ( backgroundMode() == QWidget::NoBackground ) {
+ setBackgroundMode( QWidget::NoBackground );
+ setBackgroundPixmap( m_root );
+ }
+ return;
+ }
+
+ KPixmap pixmap;
+ pixmap = QPixmap::grabWindow( qt_xrootwin(), 0, m_currentY, width(), 10 );
+ QImage image = pixmap.convertToImage();
+ KImageEffect::blend( Qt::black, image, 0.4 );
+ KImageEffect::toGray( image, true );
+ pixmap.convertFromImage( image );
+ bitBlt( this, 0, m_currentY, &pixmap );
+ bitBlt( &m_root, 0, m_currentY, &pixmap );
+ m_currentY += 10;
+ QTimer::singleShot( 1, this, SLOT( slotPaintEffect() ) );
}
- KPixmap pixmap;
- pixmap = QPixmap::grabWindow( qt_xrootwin(), 0, m_currentY, width(), 10 );
- QImage image = pixmap.convertToImage();
- KImageEffect::blend( Qt::black, image, 0.4 );
- KImageEffect::toGray( image, true );
- pixmap.convertFromImage( image );
- bitBlt( this, 0, m_currentY, &pixmap );
- bitBlt( &m_root, 0, m_currentY, &pixmap );
- m_currentY += 10;
- QTimer::singleShot( 1, this, SLOT( slotPaintEffect() ) );
}
//////
@@ -90,97 +262,363 @@ KSMShutdownDlg::KSMShutdownDlg( QWidget* parent,
: QDialog( parent, 0, TRUE, WType_Popup ), targets(0)
// this is a WType_Popup on purpose. Do not change that! Not
// having a popup here has severe side effects.
+
{
QVBoxLayout* vbox = new QVBoxLayout( this );
+
+
QFrame* frame = new QFrame( this );
frame->setFrameStyle( QFrame::StyledPanel | QFrame::Raised );
frame->setLineWidth( style().pixelMetric( QStyle::PM_DefaultFrameWidth, frame ) );
+ // we need to set the minimum size for the logout box, since it
+ // gets too small if there isn't all options available
+ frame->setMinimumWidth(400);
vbox->addWidget( frame );
vbox = new QVBoxLayout( frame, 2 * KDialog::marginHint(),
2 * KDialog::spacingHint() );
- QLabel* label = new QLabel( i18n("End Session for \"%1\"").arg(KUser().loginName()), frame );
- QFont fnt = label->font();
- fnt.setBold( true );
- fnt.setPointSize( fnt.pointSize() * 3 / 2 );
- label->setFont( fnt );
- vbox->addWidget( label, 0, AlignHCenter );
-
- QHBoxLayout* hbox = new QHBoxLayout( vbox, 2 * KDialog::spacingHint() );
-
- // konqy
- QFrame* lfrm = new QFrame( frame );
- lfrm->setFrameStyle( QFrame::Panel | QFrame::Sunken );
- hbox->addWidget( lfrm, AlignCenter );
-
- QLabel* icon = new QLabel( lfrm );
- icon->setPixmap( UserIcon( "shutdownkonq" ) );
- lfrm->setFixedSize( icon->sizeHint());
- icon->setFixedSize( icon->sizeHint());
-
- // right column (buttons)
- QVBoxLayout* buttonlay = new QVBoxLayout( hbox, 2 * KDialog::spacingHint() );
- buttonlay->setAlignment( Qt::AlignHCenter );
-
- buttonlay->addStretch( 1 );
-
- // End session
- KPushButton* btnLogout = new KPushButton( KGuiItem( i18n("&End Current Session"), "undo"), frame );
- QFont btnFont = btnLogout->font();
- buttonlay->addWidget( btnLogout );
- connect(btnLogout, SIGNAL(clicked()), SLOT(slotLogout()));
-
- if (maysd) {
-
- // Shutdown
- KPushButton* btnHalt = new KPushButton( KGuiItem( i18n("&Turn Off Computer"), "exit"), frame );
- btnHalt->setFont( btnFont );
- buttonlay->addWidget( btnHalt );
- connect(btnHalt, SIGNAL(clicked()), SLOT(slotHalt()));
- if ( sdtype == KApplication::ShutdownTypeHalt )
- btnHalt->setFocus();
-
- // Reboot
- KSMDelayedPushButton* btnReboot = new KSMDelayedPushButton( KGuiItem( i18n("&Restart Computer"), "reload"), frame );
- btnReboot->setFont( btnFont );
- buttonlay->addWidget( btnReboot );
-
- connect(btnReboot, SIGNAL(clicked()), SLOT(slotReboot()));
- if ( sdtype == KApplication::ShutdownTypeReboot )
- btnReboot->setFocus();
-
- int def, cur;
- if ( DM().bootOptions( rebootOptions, def, cur ) ) {
- targets = new QPopupMenu( frame );
- if ( cur == -1 )
- cur = def;
-
- int index = 0;
- for (QStringList::ConstIterator it = rebootOptions.begin(); it != rebootOptions.end(); ++it, ++index)
- {
- QString label = (*it);
- label=label.replace('&',"&&");
- if (index == cur)
- targets->insertItem( label + i18n("current option in boot loader", " (current)"), index);
- else
- targets->insertItem( label, index );
- }
+ // default factor
+ bool doUbuntuLogout = KConfigGroup(KGlobal::config(), "Logout").readBoolEntry("doUbuntuLogout", false);
+
+ // slighty more space for the new logout
+ int factor = 2;
- btnReboot->setPopup(targets);
- connect( targets, SIGNAL(activated(int)), SLOT(slotReboot(int)) );
+ if(doUbuntuLogout)
+ {
+ factor = 8;
}
- }
+ else {
+ QLabel* label = new QLabel( i18n("End Session for \"%1\"").arg(KUser().loginName()), frame );
+ QFont fnt = label->font();
+ fnt.setBold( true );
+ fnt.setPointSize( fnt.pointSize() * 3 / 2 );
+ label->setFont( fnt );
+ vbox->addWidget( label, 0, AlignHCenter );
+ }
+
+ // for the basic layout, within this box either the ubuntu dialog or
+ // standard konqy+buttons will be placed.
+ QHBoxLayout* hbox = new QHBoxLayout( vbox, factor * KDialog::spacingHint() );
+
+ // from here on we have to adapt to the two different dialogs
+ QFrame* lfrm;
+ QVBoxLayout* buttonlay;
+ QHBoxLayout* hbuttonbox;
+ QFont btnFont;
+
+ if(doUbuntuLogout)
+ {
+ // first line of buttons
+ hbuttonbox = new QHBoxLayout( hbox, factor * KDialog::spacingHint() );
+ hbuttonbox->setAlignment( Qt::AlignHCenter );
+ // End session
+ FlatButton* btnLogout = new FlatButton( frame );
+ btnLogout->setTextLabel( i18n("&Log out"), false );
+ btnLogout->setPixmap( DesktopIcon( "back") );
+ int i = btnLogout->textLabel().find( QRegExp("\\&"), 0 ); // i == 1
+ btnLogout->setAccel( "ALT+" + btnLogout->textLabel().lower()[i+1] ) ;
+ hbuttonbox->addWidget ( btnLogout );
+ connect(btnLogout, SIGNAL(clicked()), SLOT(slotLogout()));
- buttonlay->addStretch( 1 );
+ }
+ else
+ {
+
+ // konqy
+ lfrm = new QFrame( frame );
+ lfrm->setFrameStyle( QFrame::Panel | QFrame::Sunken );
+ hbox->addWidget( lfrm, AlignCenter );
+
+ buttonlay = new QVBoxLayout( hbox, factor * KDialog::spacingHint() );
+ buttonlay->setAlignment( Qt::AlignHCenter );
+
+ QLabel* icon = new QLabel( lfrm );
+ icon->setPixmap( UserIcon( "shutdownkonq" ) );
+ lfrm->setFixedSize( icon->sizeHint());
+ icon->setFixedSize( icon->sizeHint());
+
+ buttonlay->addStretch( 1 );
+ // End session
+ KPushButton* btnLogout = new KPushButton( KGuiItem( i18n("&End Current Session"), "undo"), frame );
+ btnFont = btnLogout->font();
+ buttonlay->addWidget( btnLogout );
+ connect(btnLogout, SIGNAL(clicked()), SLOT(slotLogout()));
+ }
- // Separator
- buttonlay->addWidget( new KSeparator( frame ) );
+
+
+ m_halCtx = NULL;
+
+ if (maysd) {
+
+ // respect lock on resume & disable suspend/hibernate settings
+ // from power-manager
+ KConfig config("power-managerrc");
+ bool disableSuspend = config.readBoolEntry("disableSuspend", false);
+ bool disableHibernate = config.readBoolEntry("disableHibernate", false);
+ m_lockOnResume = config.readBoolEntry("lockOnResume", true);
+
+ bool canSuspend = false;
+ bool canHibernate = false;
+
+ // Query HAL for suspend/resume support
+ m_halCtx = libhal_ctx_new();
+
+ DBusError error;
+ dbus_error_init(&error);
+ m_dbusConn = dbus_connection_open_private(DBUS_SYSTEM_BUS, &error);
+ if (!m_dbusConn)
+ {
+ dbus_error_free(&error);
+ libhal_ctx_free(m_halCtx);
+ m_halCtx = NULL;
+ }
+ else
+ {
+ dbus_bus_register(m_dbusConn, &error);
+ if (dbus_error_is_set(&error))
+ {
+ dbus_error_free(&error);
+ libhal_ctx_free(m_halCtx);
+ m_dbusConn = NULL;
+ m_halCtx = NULL;
+ }
+ else
+ {
+ libhal_ctx_set_dbus_connection(m_halCtx, m_dbusConn);
+ if (!libhal_ctx_init(m_halCtx, &error))
+ {
+ if (dbus_error_is_set(&error))
+ dbus_error_free(&error);
+ libhal_ctx_free(m_halCtx);
+ m_dbusConn = NULL;
+ m_halCtx = NULL;
+ }
+ }
+ }
+
+ if (m_halCtx)
+ {
+ if (libhal_device_get_property_bool(m_halCtx,
+ "/org/freedesktop/Hal/devices/computer",
+ "power_management.can_suspend",
+ NULL))
+ {
+ canSuspend = true;
+ }
+
+ if (libhal_device_get_property_bool(m_halCtx,
+ "/org/freedesktop/Hal/devices/computer",
+ "power_management.can_hibernate",
+ NULL))
+ {
+ canHibernate = true;
+ }
+ }
+
+
+ if(doUbuntuLogout) {
+
+ if (canSuspend && !disableSuspend)
+ {
+ // Suspend
+ FlatButton* btnSuspend = new FlatButton( frame );
+ btnSuspend->setTextLabel( i18n("&Suspend"), false );
+ btnSuspend->setPixmap( DesktopIcon( "suspend") );
+ int i = btnSuspend->textLabel().find( QRegExp("\\&"), 0 ); // i == 1
+ btnSuspend->setAccel( "ALT+" + btnSuspend->textLabel().lower()[i+1] ) ;
+ hbuttonbox->addWidget ( btnSuspend);
+ connect(btnSuspend, SIGNAL(clicked()), SLOT(slotSuspend()));
+ }
+
+ if (canHibernate && !disableHibernate)
+ {
+ // Hibernate
+ FlatButton* btnHibernate = new FlatButton( frame );
+ btnHibernate->setTextLabel( i18n("&Hibernate"), false );
+ btnHibernate->setPixmap( DesktopIcon( "hibernate") );
+ int i = btnHibernate->textLabel().find( QRegExp("\\&"), 0 ); // i == 1
+ btnHibernate->setAccel( "ALT+" + btnHibernate->textLabel().lower()[i+1] ) ;
+ hbuttonbox->addWidget ( btnHibernate);
+ connect(btnHibernate, SIGNAL(clicked()), SLOT(slotHibernate()));
+ }
+
+ // Separator (within buttonlay)
+ vbox->addWidget( new KSeparator( frame ) );
+
+ // bottom buttons
+ QHBoxLayout* hbuttonbox2 = new QHBoxLayout( vbox, factor * KDialog::spacingHint() );
+ hbuttonbox2->setAlignment( Qt::AlignHCenter );
+
+ // Reboot
+ FlatButton* btnReboot = new FlatButton( frame );
+ btnReboot->setTextLabel( i18n("&Restart"), false );
+ btnReboot->setPixmap( DesktopIcon( "reload") );
+ int i = btnReboot->textLabel().find( QRegExp("\\&"), 0 ); // i == 1
+ btnReboot->setAccel( "ALT+" + btnReboot->textLabel().lower()[i+1] ) ;
+ hbuttonbox2->addWidget ( btnReboot);
+ connect(btnReboot, SIGNAL(clicked()), SLOT(slotReboot()));
+ if ( sdtype == KApplication::ShutdownTypeReboot )
+ btnReboot->setFocus();
+
+ // BAD CARMA .. this code is copied line by line from standard konqy dialog
+ int def, cur;
+ if ( DM().bootOptions( rebootOptions, def, cur ) ) {
+ btnReboot->setPopupDelay(300); // visually add dropdown
+ targets = new QPopupMenu( frame );
+ if ( cur == -1 )
+ cur = def;
+
+ int index = 0;
+ for (QStringList::ConstIterator it = rebootOptions.begin(); it != rebootOptions.end(); ++it, ++index)
+ {
+ QString label = (*it);
+ label=label.replace('&',"&&");
+ if (index == cur)
+ targets->insertItem( label + i18n("current option in boot loader", " (current)"), index);
+ else
+ targets->insertItem( label, index );
+ }
+
+ btnReboot->setPopup(targets);
+ connect( targets, SIGNAL(activated(int)), SLOT(slotReboot(int)) );
+ }
+ // BAD CARMA .. this code is copied line by line from standard konqy dialog [EOF]
+
+ // Shutdown
+ FlatButton* btnHalt = new FlatButton( frame );
+ btnHalt->setTextLabel( i18n("&Turn Off"), false );
+ btnHalt->setPixmap( DesktopIcon( "exit") );
+ i = btnHalt->textLabel().find( QRegExp("\\&"), 0 ); // i == 1
+ btnHalt->setAccel( "ALT+" + btnHalt->textLabel().lower()[i+1] ) ;
+ hbuttonbox2->addWidget ( btnHalt );
+ connect(btnHalt, SIGNAL(clicked()), SLOT(slotHalt()));
+ if ( sdtype == KApplication::ShutdownTypeHalt )
+ btnHalt->setFocus();
+
+ // cancel buttonbox
+ QHBoxLayout* hbuttonbox3 = new QHBoxLayout( vbox, factor * KDialog::spacingHint() );
+ hbuttonbox3->setAlignment( Qt::AlignRight );
+
+ // Back to Desktop
+ KSMPushButton* btnBack = new KSMPushButton( KStdGuiItem::cancel(), frame );
+ hbuttonbox3->addWidget( btnBack );
+ connect(btnBack, SIGNAL(clicked()), SLOT(reject()));
+
+ }
+ else
+ {
+ // Shutdown
+ KPushButton* btnHalt = new KPushButton( KGuiItem( i18n("&Turn Off Computer"), "exit"), frame );
+ btnHalt->setFont( btnFont );
+ buttonlay->addWidget( btnHalt );
+ connect(btnHalt, SIGNAL(clicked()), SLOT(slotHalt()));
+ if ( sdtype == KApplication::ShutdownTypeHalt )
+ btnHalt->setFocus();
+
+ // Reboot
+ KSMDelayedPushButton* btnReboot = new KSMDelayedPushButton( KGuiItem( i18n("&Restart Computer"), "reload"), frame );
+ btnReboot->setFont( btnFont );
+ buttonlay->addWidget( btnReboot );
+
+ connect(btnReboot, SIGNAL(clicked()), SLOT(slotReboot()));
+ if ( sdtype == KApplication::ShutdownTypeReboot )
+ btnReboot->setFocus();
+
+ // this section is copied as-is into ubuntulogout as well
+ int def, cur;
+ if ( DM().bootOptions( rebootOptions, def, cur ) ) {
+ targets = new QPopupMenu( frame );
+ if ( cur == -1 )
+ cur = def;
+
+ int index = 0;
+ for (QStringList::ConstIterator it = rebootOptions.begin(); it != rebootOptions.end(); ++it, ++index)
+ {
+ QString label = (*it);
+ label=label.replace('&',"&&");
+ if (index == cur)
+ targets->insertItem( label + i18n("current option in boot loader", " (current)"), index);
+ else
+ targets->insertItem( label, index );
+ }
+
+ btnReboot->setPopup(targets);
+ connect( targets, SIGNAL(activated(int)), SLOT(slotReboot(int)) );
+ }
+
+
+ if (canSuspend && !disableSuspend)
+ {
+ KPushButton* btnSuspend = new KPushButton( KGuiItem( i18n("&Suspend Computer"), "suspend"), frame );
+ btnSuspend->setFont( btnFont );
+ buttonlay->addWidget( btnSuspend );
+ connect(btnSuspend, SIGNAL(clicked()), SLOT(slotSuspend()));
+ }
+
+ if (canHibernate && !disableHibernate)
+ {
+ KPushButton* btnHibernate = new KPushButton( KGuiItem( i18n("&Hibernate Computer"), "hibernate"), frame );
+ btnHibernate->setFont( btnFont );
+ buttonlay->addWidget( btnHibernate );
+ connect(btnHibernate, SIGNAL(clicked()), SLOT(slotHibernate()));
+ }
+
+ buttonlay->addStretch( 1 );
+
+ // Separator
+ buttonlay->addWidget( new KSeparator( frame ) );
+
+ // Back to Desktop
+ KPushButton* btnBack = new KPushButton( KStdGuiItem::cancel(), frame );
+ buttonlay->addWidget( btnBack );
+ connect(btnBack, SIGNAL(clicked()), SLOT(reject()));
+
+ }
- // Back to Desktop
- KPushButton* btnBack = new KPushButton( KStdGuiItem::cancel(), frame );
- buttonlay->addWidget( btnBack );
- connect(btnBack, SIGNAL(clicked()), SLOT(reject()));
+ }
+ else {
+ // finish the dialog correctly
+ if(doUbuntuLogout)
+ {
+ // cancel buttonbox
+ QHBoxLayout* hbuttonbox3 = new QHBoxLayout( vbox, factor * KDialog::spacingHint() );
+ hbuttonbox3->setAlignment( Qt::AlignRight );
+ // Back to Desktop
+ KSMPushButton* btnBack = new KSMPushButton( KStdGuiItem::cancel(), frame );
+ hbuttonbox3->addWidget( btnBack );
+
+ connect(btnBack, SIGNAL(clicked()), SLOT(reject()));
+ }
+ else
+ {
+ // Separator
+ buttonlay->addWidget( new KSeparator( frame ) );
+
+ // Back to Desktop
+ KPushButton* btnBack = new KPushButton( KStdGuiItem::cancel(), frame );
+ buttonlay->addWidget( btnBack );
+
+ connect(btnBack, SIGNAL(clicked()), SLOT(reject()));
+ }
+
+
+ }
+
+
+}
+
+
+KSMShutdownDlg::~KSMShutdownDlg()
+{
+ if (m_halCtx)
+ {
+ DBusError error;
+ dbus_error_init(&error);
+ libhal_ctx_shutdown(m_halCtx, &error);
+ libhal_ctx_free(m_halCtx);
+ }
}
@@ -215,6 +653,52 @@ void KSMShutdownDlg::slotHalt()
accept();
}
+void KSMShutdownDlg::slotSuspend()
+{
+ if (m_lockOnResume) {
+ DCOPRef("kdesktop", "KScreensaverIface").send("lock");
+ }
+
+ if (m_dbusConn)
+ {
+ DBusMessage *msg = dbus_message_new_method_call(
+ "org.freedesktop.Hal",
+ "/org/freedesktop/Hal/devices/computer",
+ "org.freedesktop.Hal.Device.SystemPowerManagement",
+ "Suspend");
+
+ int wakeup=0;
+ dbus_message_append_args(msg, DBUS_TYPE_INT32, &wakeup, DBUS_TYPE_INVALID);
+
+ dbus_connection_send(m_dbusConn, msg, NULL);
+
+ dbus_message_unref(msg);
+ }
+
+ reject(); // continue on resume
+}
+
+void KSMShutdownDlg::slotHibernate()
+{
+ if (m_lockOnResume) {
+ DCOPRef("kdesktop", "KScreensaverIface").send("lock");
+ }
+
+ if (m_dbusConn)
+ {
+ DBusMessage *msg = dbus_message_new_method_call(
+ "org.freedesktop.Hal",
+ "/org/freedesktop/Hal/devices/computer",
+ "org.freedesktop.Hal.Device.SystemPowerManagement",
+ "Hibernate");
+
+ dbus_connection_send(m_dbusConn, msg, NULL);
+
+ dbus_message_unref(msg);
+ }
+
+ reject(); // continue on resume
+}
bool KSMShutdownDlg::confirmShutdown( bool maysd, KApplication::ShutdownType& sdtype, QString& bootOption )
{
@@ -276,3 +760,132 @@ void KSMDelayedPushButton::slotTimeout()
popt->stop();
setDown(false);
}
+
+KSMPushButton::KSMPushButton( const KGuiItem &item,
+ QWidget *parent,
+ const char *name)
+ : KPushButton( item, parent, name),
+ m_pressed(false)
+{
+ setDefault( false );
+ setAutoDefault ( false );
+}
+
+
+void KSMPushButton::keyPressEvent( QKeyEvent* e )
+{
+switch ( e->key() )
+ {
+ case Key_Enter:
+ case Key_Return:
+ case Key_Space:
+ m_pressed = TRUE;
+ setDown(true);
+ emit pressed();
+ break;
+ case Key_Escape:
+ e->ignore();
+ break;
+ default:
+ e->ignore();
+ }
+
+ QPushButton::keyPressEvent(e);
+}
+
+
+void KSMPushButton::keyReleaseEvent( QKeyEvent* e )
+{
+ switch ( e->key() )
+ {
+ case Key_Space:
+ case Key_Enter:
+ case Key_Return:
+ if ( m_pressed )
+ {
+ setDown(false);
+ m_pressed = FALSE;
+ emit released();
+ emit clicked();
+ }
+ break;
+ case Key_Escape:
+ e->ignore();
+ break;
+ default:
+ e->ignore();
+ }
+
+}
+
+
+
+
+FlatButton::FlatButton( QWidget *parent, const char *name )
+ : QToolButton( parent, name/*, WNoAutoErase*/ ),
+ m_pressed(false)
+{
+ init();
+}
+
+
+FlatButton::~FlatButton() {}
+
+
+void FlatButton::init()
+{
+ setUsesTextLabel(true);
+ setUsesBigPixmap(true);
+ setAutoRaise(true);
+ setTextPosition( QToolButton::Under );
+ setFocusPolicy(QWidget::StrongFocus);
+ }
+
+
+void FlatButton::keyPressEvent( QKeyEvent* e )
+{
+ switch ( e->key() )
+ {
+ case Key_Enter:
+ case Key_Return:
+ case Key_Space:
+ m_pressed = TRUE;
+ setDown(true);
+ emit pressed();
+ break;
+ case Key_Escape:
+ e->ignore();
+ break;
+ default:
+ e->ignore();
+ }
+
+ QToolButton::keyPressEvent(e);
+}
+
+
+void FlatButton::keyReleaseEvent( QKeyEvent* e )
+{
+ switch ( e->key() )
+ {
+ case Key_Space:
+ case Key_Enter:
+ case Key_Return:
+ if ( m_pressed )
+ {
+ setDown(false);
+ m_pressed = FALSE;
+ emit released();
+ emit clicked();
+ }
+ break;
+ case Key_Escape:
+ e->ignore();
+ break;
+ default:
+ e->ignore();
+ }
+
+}
+
+
diff --git a/ksmserver/shutdowndlg.h b/ksmserver/shutdowndlg.h
index 9fcb77c51..d696dff71 100644
--- a/ksmserver/shutdowndlg.h
+++ b/ksmserver/shutdowndlg.h
@@ -8,23 +8,40 @@ Copyright (C) 2000 Matthias Ettrich
#define SHUTDOWNDLG_H
#include
+#include
+#include
#include
#include
+#include
+#include
+#include
+#include
+
class QPushButton;
class QVButtonGroup;
class QPopupMenu;
class QTimer;
+class QPainter;
+class QString;
+class KAction;
+
#include
+#include
-// The (singleton) widget that makes the desktop gray.
+/* We acknowledge the the dbus API is unstable */
+#define DBUS_API_SUBJECT_TO_CHANGE
+#include
+#include
+
+// The (singleton) widget that makes/fades the desktop gray.
class KSMShutdownFeedback : public QWidget
{
Q_OBJECT
public:
- static void start() { s_pSelf = new KSMShutdownFeedback(); s_pSelf->show(); }
- static void stop() { delete s_pSelf; s_pSelf = 0L; }
+ static void start() { s_pSelf = new KSMShutdownFeedback(); }
+ static void stop() { if ( s_pSelf != 0L ) s_pSelf->fadeBack(); delete s_pSelf; s_pSelf = 0L; }
static KSMShutdownFeedback * self() { return s_pSelf; }
protected:
@@ -38,6 +55,17 @@ private:
KSMShutdownFeedback();
int m_currentY;
QPixmap m_root;
+ void fadeBack( void );
+ float m_grayOpacity;
+ float m_compensation;
+ bool m_fadeBackwards;
+ bool m_readDelayComplete;
+ QImage m_unfadedImage;
+ QImage m_grayImage;
+ QTime m_fadeTime;
+ int m_rowsDone;
+ KPixmapIO m_pmio;
+
};
@@ -54,9 +82,11 @@ public slots:
void slotHalt();
void slotReboot();
void slotReboot(int);
+ void slotSuspend();
+ void slotHibernate();
protected:
- ~KSMShutdownDlg() {};
+ ~KSMShutdownDlg();
private:
KSMShutdownDlg( QWidget* parent, bool maysd, KApplication::ShutdownType sdtype );
@@ -64,6 +94,9 @@ private:
QString m_bootOption;
QPopupMenu *targets;
QStringList rebootOptions;
+ LibHalContext* m_halCtx;
+ DBusConnection *m_dbusConn;
+ bool m_lockOnResume;
};
class KSMDelayedPushButton : public KPushButton
@@ -85,4 +118,51 @@ private:
QTimer *popt;
};
+class KSMPushButton : public KPushButton
+{
+ Q_OBJECT
+
+public:
+
+ KSMPushButton( const KGuiItem &item, QWidget *parent, const char *name = 0 );
+
+protected:
+ virtual void keyPressEvent(QKeyEvent*e);
+ virtual void keyReleaseEvent(QKeyEvent*e);
+
+private:
+
+ bool m_pressed;
+
+};
+
+
+
+class FlatButton : public QToolButton
+{
+ Q_OBJECT
+
+ public:
+
+ FlatButton( QWidget *parent = 0, const char *name = 0 );
+ ~FlatButton();
+
+ protected:
+ virtual void keyPressEvent(QKeyEvent*e);
+ virtual void keyReleaseEvent(QKeyEvent*e);
+
+ private slots:
+
+ private:
+ void init();
+
+ bool m_pressed;
+ QString m_text;
+ QPixmap m_pixmap;
+
+};
+
+
+
+
#endif
diff --git a/ksplashml/main.cpp b/ksplashml/main.cpp
index c1208cc3b..2a79723d2 100644
--- a/ksplashml/main.cpp
+++ b/ksplashml/main.cpp
@@ -54,12 +54,6 @@ int main( int argc, char **argv )
KCmdLineArgs::addCmdLineOptions(options);
KCmdLineArgs *arg = KCmdLineArgs::parsedArgs();
- if( arg->isSet( "fork" ) )
- {
- if (fork())
- exit(0);
- }
-
if ( !( arg->isSet( "dcop" ) ) )
KApplication::disableAutoDcopRegistration();
else if ( KApplication::dcopClient()->attach() )
@@ -75,6 +69,18 @@ int main( int argc, char **argv )
wndMain.setStartupItemCount( steps );
}
+ // The position of this fork() matters, fork too early and you risk the
+ // calls to KSplash::programStarted being missed. Now that wndMain has
+ // been instantiated it is safe to do this. An earlier version of
+ // this program had this fork occuring before the instantiation,
+ // and this led to a race condition where if ksplash lost the race it would
+ // hang because it would wait for signals that had already been sent
+ if( arg->isSet( "fork" ) )
+ {
+ if (fork())
+ exit(0);
+ }
+
app.setMainWidget(&wndMain);
app.setTopWidget(&wndMain);
return(app.exec());
diff --git a/ksysguard/configure.in.in b/ksysguard/configure.in.in
index 0173b28ea..f4ab83853 100644
--- a/ksysguard/configure.in.in
+++ b/ksysguard/configure.in.in
@@ -3,6 +3,7 @@ AC_MSG_CHECKING([if ksysguardd can be compiled])
case "$host" in
*-*-linux*) ksysguardd_compile=yes; UNAME='Linux' ;;
*-*-freebsd*) ksysguardd_compile=yes; UNAME='FreeBSD' ;;
+ *-*-kfreebsd*-gnu) ksysguardd_compile=yes; UNAME='Linux' ;;
*-*-dragonfly*) ksysguardd_compile=yes; UNAME='FreeBSD' ;;
*-*-netbsd*) ksysguardd_compile=yes; UNAME='NetBSD' ;;
*-*-solaris*) ksysguardd_compile=yes; UNAME='Solaris' ;;
diff --git a/ksysguard/gui/Makefile.am b/ksysguard/gui/Makefile.am
index c0b9d12b3..fd798bc61 100644
--- a/ksysguard/gui/Makefile.am
+++ b/ksysguard/gui/Makefile.am
@@ -59,5 +59,5 @@ METASOURCES = AUTO
messages: rc.cpp
$(EXTRACTRC) `find . -name "*.ui"` >> rc.cpp
- $(EXTRACTATTR) --attr=display,title SystemLoad.sgrd KSysGuardApplet.xml >> rc.cpp
+ extractattr --attr=display,title SystemLoad.sgrd KSysGuardApplet.xml >> rc.cpp
$(XGETTEXT) `find . -name "*.cpp" -o -name "*.cc"` -o $(podir)/ksysguard.pot
diff --git a/ksysguard/ksysguardd/Linux/ProcessList.c b/ksysguard/ksysguardd/Linux/ProcessList.c
index b267c7005..e9e8c1315 100644
--- a/ksysguard/ksysguardd/Linux/ProcessList.c
+++ b/ksysguard/ksysguardd/Linux/ProcessList.c
@@ -292,7 +292,7 @@ static int updateProcess( int pid )
strncmp( ps->cmdline, "kdeinit: ", KDEINITLEN ) == 0 &&
strcmp( ps->cmdline + KDEINITLEN, "Running..." ) != 0 ) {
size_t len;
- char* end = strchr( ps->cmdline + KDEINITLEN, ' ' );
+ char* end = (char*)strchr( ps->cmdline + KDEINITLEN, ' ' );
if ( end )
len = ( end - ps->cmdline ) - KDEINITLEN;
else
diff --git a/ksysguard/ksysguardd/Linux/acpi.c b/ksysguard/ksysguardd/Linux/acpi.c
index b3100c363..6e9470b59 100644
--- a/ksysguard/ksysguardd/Linux/acpi.c
+++ b/ksysguard/ksysguardd/Linux/acpi.c
@@ -130,7 +130,7 @@ int updateAcpiBattery( void )
p = AcpiBatInfoBuf;
while ( ( p!= NULL ) && ( sscanf( p, "last full capacity: %d ",
&AcpiBatCapacity ) != 1 ) ) {
- p = strchr( p, '\n' );
+ p = (char*)strchr( p, '\n' );
if ( p )
p++;
}
@@ -152,7 +152,7 @@ int updateAcpiBattery( void )
p = AcpiBatStateBuf;
while ( ( p!= NULL ) && ( sscanf( p, "remaining capacity: %d ",
&AcpiBatRemainingCapacity ) != 1 ) ) {
- p = strchr( p, '\n' );
+ p = (char*)strchr( p, '\n' );
if ( p )
p++;
}
@@ -161,7 +161,7 @@ int updateAcpiBattery( void )
p = AcpiBatStateBuf;
while ( ( p!= NULL ) && ( sscanf( p, "present rate: %d ",
&AcpiBatteryUsage[i] ) != 1 ) ) {
- p = strchr( p, '\n' );
+ p = (char*)strchr( p, '\n' );
if ( p )
p++;
}
@@ -229,12 +229,12 @@ void printAcpiBatUsageInfo( const char* cmd)
static int extract_zone_name(char **startidx, const char *cmd)
{
char *idx = NULL;
- idx = strchr(cmd, '/');
+ idx = (char*)strchr(cmd, '/');
if (idx == NULL) return 0;
- idx = strchr(idx+1, '/');
+ idx = (char*)strchr(idx+1, '/');
if (idx == NULL) return 0;
*startidx = idx+1;
- idx = strchr(*startidx, '/');
+ idx = (char*)strchr(*startidx, '/');
if (idx == NULL) return 0;
return idx - *startidx;
}
diff --git a/ksysguard/ksysguardd/Linux/cpuinfo.c b/ksysguard/ksysguardd/Linux/cpuinfo.c
index de5deb80f..fa55aabd9 100644
--- a/ksysguard/ksysguardd/Linux/cpuinfo.c
+++ b/ksysguard/ksysguardd/Linux/cpuinfo.c
@@ -83,7 +83,7 @@ static void processCpuInfo( void )
sscanf( value, "%f", &Clocks[ cpuId ] );
/* Move cibp to begining of next line, if there is one. */
- cibp = strchr( cibp, '\n' );
+ cibp = (char*)strchr( cibp, '\n' );
if ( cibp )
cibp++;
else
diff --git a/ksysguard/ksysguardd/Linux/netdev.c b/ksysguard/ksysguardd/Linux/netdev.c
index 55e812807..867678642 100644
--- a/ksysguard/ksysguardd/Linux/netdev.c
+++ b/ksysguard/ksysguardd/Linux/netdev.c
@@ -142,7 +142,7 @@ static int processNetDev_( void )
netDevBufP += strlen( buf ) + 1; /* move netDevBufP to next line */
if ( sscanf( buf, devFormat, tag ) ) {
- char* pos = strchr( tag, ':' );
+ char* pos = (char*)strchr( tag, ':' );
if ( pos ) {
FORALL( DEFVARS );
*pos = '\0';
@@ -227,7 +227,7 @@ void initNetDev( struct SensorModul* sm )
netDevBufP += strlen( buf ) + 1; /* move netDevBufP to next line */
if ( sscanf( buf, devFormat, tag ) ) {
- char* pos = strchr( tag, ':' );
+ char* pos = (char*)strchr( tag, ':' );
if ( pos ) {
char mon[ MON_SIZE ];
*pos = '\0';
@@ -339,9 +339,9 @@ void printNetDev##a( const char* cmd ) \
char* end; \
char dev[ 64 ]; \
\
- beg = strchr( cmd, '/' ); \
- beg = strchr( beg + 1, '/' ); \
- end = strchr( beg + 1, '/' ); \
+ beg = (char*)strchr( cmd, '/' ); \
+ beg = (char*)strchr( beg + 1, '/' ); \
+ end = (char*)strchr( beg + 1, '/' ); \
strncpy( dev, beg + 1, end - beg - 1 ); \
dev[ end - beg - 1 ] = '\0'; \
\
diff --git a/ksysguard/ksysguardd/Linux/stat.c b/ksysguard/ksysguardd/Linux/stat.c
index 0e03e4d53..9bc576deb 100644
--- a/ksysguard/ksysguardd/Linux/stat.c
+++ b/ksysguard/ksysguardd/Linux/stat.c
@@ -267,10 +267,10 @@ static int processDiskIO( const char* buf )
}
/* Move p after the sencond ')'. We can safely assume that
* those two ')' exist. */
- p = strchr( p, ')' ) + 1;
- p = strchr( p, ')' ) + 1;
+ p = (char*)strchr( p, ')' ) + 1;
+ p = (char*)strchr( p, ')' ) + 1;
if ( p && *p )
- p = strchr( p, '(' );
+ p = (char*)strchr( p, '(' );
}
return 0;
diff --git a/ksysguard/ksysguardd/Solaris/NetDev.c b/ksysguard/ksysguardd/Solaris/NetDev.c
index 89db266cb..836e2832b 100644
--- a/ksysguard/ksysguardd/Solaris/NetDev.c
+++ b/ksysguard/ksysguardd/Solaris/NetDev.c
@@ -436,9 +436,9 @@ void printIPackets( const char *cmd ) {
char *name, *ptr;
int i;
- ptr = strchr( cmdcopy, (int) '/' );
+ ptr = (char*)strchr( cmdcopy, (int) '/' );
name = ++ptr;
- ptr = strchr( name, (int) '/' );
+ ptr = (char*)strchr( name, (int) '/' );
*ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) {
@@ -464,9 +464,9 @@ void printOPackets( const char *cmd ) {
char *name, *ptr;
int i;
- ptr = strchr( cmdcopy, (int) '/' );
+ ptr = (char*)strchr( cmdcopy, (int) '/' );
name = ++ptr;
- ptr = strchr( name, (int) '/' );
+ ptr = (char*)strchr( name, (int) '/' );
*ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) {
@@ -492,9 +492,9 @@ void printIErrors( const char *cmd ) {
char *name, *ptr;
int i;
- ptr = strchr( cmdcopy, (int) '/' );
+ ptr = (char*)strchr( cmdcopy, (int) '/' );
name = ++ptr;
- ptr = strchr( name, (int) '/' );
+ ptr = (char*)strchr( name, (int) '/' );
*ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) {
@@ -520,9 +520,9 @@ void printOErrors( const char *cmd ) {
char *name, *ptr;
int i;
- ptr = strchr( cmdcopy, (int) '/' );
+ ptr = (char*)strchr( cmdcopy, (int) '/' );
name = ++ptr;
- ptr = strchr( name, (int) '/' );
+ ptr = (char*)strchr( name, (int) '/' );
*ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) {
@@ -548,9 +548,9 @@ void printCollisions( const char *cmd ) {
char *name, *ptr;
int i;
- ptr = strchr( cmdcopy, (int) '/' );
+ ptr = (char*)strchr( cmdcopy, (int) '/' );
name = ++ptr;
- ptr = strchr( name, (int) '/' );
+ ptr = (char*)strchr( name, (int) '/' );
*ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) {
@@ -576,9 +576,9 @@ void printMultiXmits( const char *cmd ) {
char *name, *ptr;
int i;
- ptr = strchr( cmdcopy, (int) '/' );
+ ptr = (char*)strchr( cmdcopy, (int) '/' );
name = ++ptr;
- ptr = strchr( name, (int) '/' );
+ ptr = (char*)strchr( name, (int) '/' );
*ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) {
@@ -604,9 +604,9 @@ void printMultiRecvs( const char *cmd ) {
char *name, *ptr;
int i;
- ptr = strchr( cmdcopy, (int) '/' );
+ ptr = (char*)strchr( cmdcopy, (int) '/' );
name = ++ptr;
- ptr = strchr( name, (int) '/' );
+ ptr = (char*)strchr( name, (int) '/' );
*ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) {
@@ -632,9 +632,9 @@ void printBcastXmits( const char *cmd ) {
char *name, *ptr;
int i;
- ptr = strchr( cmdcopy, (int) '/' );
+ ptr = (char*)strchr( cmdcopy, (int) '/' );
name = ++ptr;
- ptr = strchr( name, (int) '/' );
+ ptr = (char*)strchr( name, (int) '/' );
*ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) {
@@ -660,9 +660,9 @@ void printBcastRecvs( const char *cmd ) {
char *name, *ptr;
int i;
- ptr = strchr( cmdcopy, (int) '/' );
+ ptr = (char*)strchr( cmdcopy, (int) '/' );
name = ++ptr;
- ptr = strchr( name, (int) '/' );
+ ptr = (char*)strchr( name, (int) '/' );
*ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) {
diff --git a/ksysguard/ksysguardd/Tru64/NetDev.c b/ksysguard/ksysguardd/Tru64/NetDev.c
index 0699b929a..a28c7ecf7 100644
--- a/ksysguard/ksysguardd/Tru64/NetDev.c
+++ b/ksysguard/ksysguardd/Tru64/NetDev.c
@@ -435,9 +435,9 @@ void printIPackets( const char *cmd ) {
char *name, *ptr;
int i;
- ptr = strchr( cmdcopy, (int) '/' );
+ ptr = (char*)strchr( cmdcopy, (int) '/' );
name = ++ptr;
- ptr = strchr( name, (int) '/' );
+ ptr = (char*)strchr( name, (int) '/' );
*ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) {
@@ -463,9 +463,9 @@ void printOPackets( const char *cmd ) {
char *name, *ptr;
int i;
- ptr = strchr( cmdcopy, (int) '/' );
+ ptr = (char*)strchr( cmdcopy, (int) '/' );
name = ++ptr;
- ptr = strchr( name, (int) '/' );
+ ptr = (char*)strchr( name, (int) '/' );
*ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) {
@@ -491,9 +491,9 @@ void printIErrors( const char *cmd ) {
char *name, *ptr;
int i;
- ptr = strchr( cmdcopy, (int) '/' );
+ ptr = (char*)strchr( cmdcopy, (int) '/' );
name = ++ptr;
- ptr = strchr( name, (int) '/' );
+ ptr = (char*)strchr( name, (int) '/' );
*ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) {
@@ -519,9 +519,9 @@ void printOErrors( const char *cmd ) {
char *name, *ptr;
int i;
- ptr = strchr( cmdcopy, (int) '/' );
+ ptr = (char*)strchr( cmdcopy, (int) '/' );
name = ++ptr;
- ptr = strchr( name, (int) '/' );
+ ptr = (char*)strchr( name, (int) '/' );
*ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) {
@@ -547,9 +547,9 @@ void printCollisions( const char *cmd ) {
char *name, *ptr;
int i;
- ptr = strchr( cmdcopy, (int) '/' );
+ ptr = (char*)strchr( cmdcopy, (int) '/' );
name = ++ptr;
- ptr = strchr( name, (int) '/' );
+ ptr = (char*)strchr( name, (int) '/' );
*ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) {
@@ -575,9 +575,9 @@ void printMultiXmits( const char *cmd ) {
char *name, *ptr;
int i;
- ptr = strchr( cmdcopy, (int) '/' );
+ ptr = (char*)strchr( cmdcopy, (int) '/' );
name = ++ptr;
- ptr = strchr( name, (int) '/' );
+ ptr = (char*)strchr( name, (int) '/' );
*ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) {
@@ -603,9 +603,9 @@ void printMultiRecvs( const char *cmd ) {
char *name, *ptr;
int i;
- ptr = strchr( cmdcopy, (int) '/' );
+ ptr = (char*)strchr( cmdcopy, (int) '/' );
name = ++ptr;
- ptr = strchr( name, (int) '/' );
+ ptr = (char*)strchr( name, (int) '/' );
*ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) {
@@ -631,9 +631,9 @@ void printBcastXmits( const char *cmd ) {
char *name, *ptr;
int i;
- ptr = strchr( cmdcopy, (int) '/' );
+ ptr = (char*)strchr( cmdcopy, (int) '/' );
name = ++ptr;
- ptr = strchr( name, (int) '/' );
+ ptr = (char*)strchr( name, (int) '/' );
*ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) {
@@ -659,9 +659,9 @@ void printBcastRecvs( const char *cmd ) {
char *name, *ptr;
int i;
- ptr = strchr( cmdcopy, (int) '/' );
+ ptr = (char*)strchr( cmdcopy, (int) '/' );
name = ++ptr;
- ptr = strchr( name, (int) '/' );
+ ptr = (char*)strchr( name, (int) '/' );
*ptr = '\0';
for( i = 0; i < NetDevCount; i++ ) {
diff --git a/ksysguard/ksysguardd/conf.c b/ksysguard/ksysguardd/conf.c
index 1d857137b..7f48ee590 100644
--- a/ksysguard/ksysguardd/conf.c
+++ b/ksysguard/ksysguardd/conf.c
@@ -93,9 +93,9 @@ void parseConfigFile( const char *filename )
if ( line[ strlen( line ) - 1 ] == '\n' )
line[ strlen( line ) - 1 ] = '\0';
- if ( !strncmp( line, "RegisterDomain",14) && (begin = strchr( line, '=' )) ) RegisterDomain=strdup(begin+1);
+ if ( !strncmp( line, "RegisterDomain",14) && (begin = (char*)strchr( line, '=' )) ) RegisterDomain=strdup(begin+1);
- if ( !strncmp( line, "LogFiles", 8 ) && (begin = strchr( line, '=' )) ) {
+ if ( !strncmp( line, "LogFiles", 8 ) && (begin = (char*)strchr( line, '=' )) ) {
begin++;
for ( token = strtok( begin, "," ); token; token = strtok( NULL, "," ) ) {
@@ -104,7 +104,7 @@ void parseConfigFile( const char *filename )
continue;
}
confLog->name = strdup( token );
- tmp = strchr( confLog->name, ':' );
+ tmp = (char*)strchr( confLog->name, ':' );
*tmp = '\0';
confLog->path = tmp;
confLog->path++;
@@ -113,7 +113,7 @@ void parseConfigFile( const char *filename )
}
}
- if ( !strncmp( line, "Sensors", 7 ) && (begin = strchr( line, '=' )) ) {
+ if ( !strncmp( line, "Sensors", 7 ) && (begin = (char*)strchr( line, '=' )) ) {
begin++;
for ( token = strtok( begin, ","); token; token = strtok( NULL, "," ) )
diff --git a/kwin/KWinInterface.h b/kwin/KWinInterface.h
index d368ec368..bca7354b5 100644
--- a/kwin/KWinInterface.h
+++ b/kwin/KWinInterface.h
@@ -16,6 +16,7 @@ class KWinInterface : virtual public DCOPObject
virtual void refresh() = 0;
virtual void doNotManage(QString)= 0;
virtual void showWindowMenuAt(unsigned long winId, int x, int y)= 0;
+ virtual void kDestopResized() = 0;
virtual void setDesktopLayout(int orientation, int x, int y)= 0;
virtual bool setCurrentDesktop(int)= 0;
virtual int currentDesktop() const = 0;
diff --git a/kwin/activation.cpp b/kwin/activation.cpp
index 2551519ec..a6844b737 100644
--- a/kwin/activation.cpp
+++ b/kwin/activation.cpp
@@ -360,6 +360,8 @@ void Workspace::takeActivity( Client* c, int flags, bool handled )
return;
}
c->takeActivity( flags, handled, Allowed );
+ if( !c->isOnScreen( active_screen ))
+ active_screen = c->screen();
}
void Workspace::handleTakeActivity( Client* c, Time /*timestamp*/, int flags )
@@ -413,6 +415,13 @@ bool Workspace::activateNextClient( Client* c )
{
if( !(*it)->isShown( false ) || !(*it)->isOnCurrentDesktop())
continue;
+ if( options->separateScreenFocus )
+ {
+ if( c != NULL && !(*it)->isOnScreen( c->screen()))
+ continue;
+ if( c == NULL && !(*it)->isOnScreen( activeScreen()))
+ continue;
+ }
if( mainwindows.contains( *it ))
{
get_focus = *it;
@@ -438,6 +447,31 @@ bool Workspace::activateNextClient( Client* c )
return true;
}
+void Workspace::setCurrentScreen( int new_screen )
+ {
+ if (new_screen < 0 || new_screen > numScreens())
+ return;
+ if ( !options->focusPolicyIsReasonable())
+ return;
+ closeActivePopup();
+ Client* get_focus = NULL;
+ for( ClientList::ConstIterator it = focus_chain[currentDesktop()].fromLast();
+ it != focus_chain[currentDesktop()].end();
+ --it )
+ {
+ if( !(*it)->isShown( false ) || !(*it)->isOnCurrentDesktop())
+ continue;
+ if( !(*it)->screen() == new_screen )
+ continue;
+ get_focus = *it;
+ break;
+ }
+ if( get_focus == NULL )
+ get_focus = findDesktop( true, currentDesktop());
+ if( get_focus != NULL && get_focus != mostRecentlyActivatedClient())
+ requestFocus( get_focus );
+ active_screen = new_screen;
+ }
void Workspace::gotFocusIn( const Client* c )
{
@@ -860,6 +894,8 @@ void Client::startupIdChanged()
desktop = asn_data.desktop();
if( !isOnAllDesktops())
workspace()->sendClientToDesktop( this, desktop, true );
+ if( asn_data.xinerama() != -1 )
+ workspace()->sendClientToScreen( this, asn_data.xinerama());
Time timestamp = asn_id.timestamp();
if( timestamp == 0 && asn_data.timestamp() != -1U )
timestamp = asn_data.timestamp();
diff --git a/kwin/client.cpp b/kwin/client.cpp
index fe8c59c58..9fc5353df 100644
--- a/kwin/client.cpp
+++ b/kwin/client.cpp
@@ -1255,6 +1255,20 @@ bool Client::isOnCurrentDesktop() const
return isOnDesktop( workspace()->currentDesktop());
}
+int Client::screen() const
+ {
+ if( !options->xineramaEnabled )
+ return 0;
+ return workspace()->screenNumber( geometry().center());
+ }
+
+bool Client::isOnScreen( int screen ) const
+ {
+ if( !options->xineramaEnabled )
+ return screen == 0;
+ return workspace()->screenGeometry( screen ).intersects( geometry());
+ }
+
// performs activation and/or raising of the window
void Client::takeActivity( int flags, bool handled, allowed_t )
{
diff --git a/kwin/client.h b/kwin/client.h
index d0d8e9d54..0905b5794 100644
--- a/kwin/client.h
+++ b/kwin/client.h
@@ -118,6 +118,9 @@ class Client : public QObject, public KDecorationDefines
bool isOnCurrentDesktop() const;
bool isOnAllDesktops() const;
void setOnAllDesktops( bool set );
+
+ bool isOnScreen( int screen ) const; // true if it's at least partially there
+ int screen() const; // the screen where the center is
// !isMinimized() && not hidden, i.e. normally visible on some virtual desktop
bool isShown( bool shaded_is_shown ) const;
diff --git a/kwin/geometry.cpp b/kwin/geometry.cpp
index 7c64eadcf..cff5a3a19 100644
--- a/kwin/geometry.cpp
+++ b/kwin/geometry.cpp
@@ -43,13 +43,30 @@ namespace KWinInternal
*/
void Workspace::desktopResized()
{
- QRect geom = QApplication::desktop()->geometry();
+ printf("Workspace::desktopResized()\n\r");
+ QRect geom = KApplication::desktop()->geometry();
NETSize desktop_geometry;
desktop_geometry.width = geom.width();
desktop_geometry.height = geom.height();
rootInfo->setDesktopGeometry( -1, desktop_geometry );
- updateClientArea();
+ updateClientArea( true );
+ checkElectricBorders( true );
+ }
+
+/*!
+ Resizes the workspace after kdesktop signals a desktop resize
+ */
+void Workspace::kDestopResized()
+ {
+ printf("Workspace::kDesktopResized()\n\r");
+ QRect geom = KApplication::desktop()->geometry();
+ NETSize desktop_geometry;
+ desktop_geometry.width = geom.width();
+ desktop_geometry.height = geom.height();
+ rootInfo->setDesktopGeometry( -1, desktop_geometry );
+
+ updateClientArea( true );
checkElectricBorders( true );
}
@@ -211,14 +228,11 @@ void Workspace::updateClientArea()
\sa geometry()
*/
-QRect Workspace::clientArea( clientAreaOption opt, const QPoint& p, int desktop ) const
+QRect Workspace::clientArea( clientAreaOption opt, int screen, int desktop ) const
{
if( desktop == NETWinInfo::OnAllDesktops || desktop == 0 )
desktop = currentDesktop();
QDesktopWidget *desktopwidget = KApplication::desktop();
- int screen = desktopwidget->isVirtualDesktop() ? desktopwidget->screenNumber( p ) : desktopwidget->primaryScreen();
- if( screen < 0 )
- screen = desktopwidget->primaryScreen();
QRect sarea = screenarea // may be NULL during KWin initialization
? screenarea[ desktop ][ screen ]
: desktopwidget->screenGeometry( screen );
@@ -263,11 +277,21 @@ QRect Workspace::clientArea( clientAreaOption opt, const QPoint& p, int desktop
return QRect();
}
+QRect Workspace::clientArea( clientAreaOption opt, const QPoint& p, int desktop ) const
+ {
+ QDesktopWidget *desktopwidget = KApplication::desktop();
+ int screen = desktopwidget->screenNumber( p );
+ if( screen < 0 )
+ screen = desktopwidget->primaryScreen();
+ return clientArea( opt, screen, desktop );
+ }
+
QRect Workspace::clientArea( clientAreaOption opt, const Client* c ) const
{
return clientArea( opt, c->geometry().center(), c->desktop());
}
+
/*!
Client \a c is moved around to position \a pos. This gives the
workspace the opportunity to interveniate and to implement
@@ -896,10 +920,6 @@ void Client::checkWorkspacePosition()
setGeometry( area );
return;
}
- if( maximizeMode() != MaximizeRestore )
- // TODO update geom_restore?
- changeMaximize( false, false, true ); // adjust size
-
if( isFullScreen())
{
QRect area = workspace()->clientArea( FullScreenArea, this );
@@ -926,6 +946,10 @@ void Client::checkWorkspacePosition()
return;
}
+ if( maximizeMode() != MaximizeRestore )
+ // TODO update geom_restore?
+ changeMaximize( false, false, true ); // adjust size
+
if( !isShade()) // TODO
{
int old_diff_x = workarea_diff_x;
@@ -1722,6 +1746,7 @@ void Client::setGeometry( int x, int y, int w, int h, ForceGeometry_t force )
sendSyntheticConfigureNotify();
updateWindowRules();
checkMaximizeGeometry();
+ workspace()->checkActiveScreen( this );
}
void Client::plainResize( int w, int h, ForceGeometry_t force )
@@ -1775,6 +1800,7 @@ void Client::plainResize( int w, int h, ForceGeometry_t force )
sendSyntheticConfigureNotify();
updateWindowRules();
checkMaximizeGeometry();
+ workspace()->checkActiveScreen( this );
}
/*!
@@ -1795,6 +1821,7 @@ void Client::move( int x, int y, ForceGeometry_t force )
sendSyntheticConfigureNotify();
updateWindowRules();
checkMaximizeGeometry();
+ workspace()->checkActiveScreen( this );
}
diff --git a/kwin/kcmkwin/kwinoptions/windows.cpp b/kwin/kcmkwin/kwinoptions/windows.cpp
index db682b316..aa779125b 100644
--- a/kwin/kcmkwin/kwinoptions/windows.cpp
+++ b/kwin/kcmkwin/kwinoptions/windows.cpp
@@ -76,6 +76,8 @@
#define KWIN_SHADEHOVER_INTERVAL "ShadeHoverInterval"
#define KWIN_FOCUS_STEALING "FocusStealingPreventionLevel"
#define KWIN_HIDE_UTILITY "HideUtilityWindowsForInactive"
+#define KWIN_SEPARATE_SCREEN_FOCUS "SeparateScreenFocus"
+#define KWIN_ACTIVE_MOUSE_SCREEN "ActiveMouseScreen"
// kwm config keywords
#define KWM_ELECTRIC_BORDER "ElectricBorders"
@@ -209,6 +211,27 @@ KFocusConfig::KFocusConfig (bool _standAlone, KConfig *_config, QWidget * parent
QWhatsThis::add( delayFocus, i18n("This is the delay after which the window the mouse pointer is over"
" will automatically receive focus.") );
+ separateScreenFocus = new QCheckBox( i18n( "S&eparate screen focus" ), fcsBox );
+ fLay->addWidget( separateScreenFocus );
+ wtstr = i18n( "When this option is enabled, focus operations are limited only to the active Xinerama screen" );
+ QWhatsThis::add( separateScreenFocus, wtstr );
+
+ activeMouseScreen = new QCheckBox( i18n( "Active &mouse screen" ), fcsBox );
+ fLay->addWidget( activeMouseScreen );
+ wtstr = i18n( "When this option is enabled, active Xinerama screen (where for example new windows appear)"
+ " is the screen with the mouse pointer. When disabled, the active Xinerama screen is the screen"
+ " with the focused window. This option is by default disabled for Click to focus and"
+ " enabled for other focus policies." );
+ QWhatsThis::add( activeMouseScreen, wtstr );
+ connect(focusCombo, SIGNAL(activated(int)), this, SLOT(updateActiveMouseScreen()));
+
+ if (!QApplication::desktop()->isVirtualDesktop() ||
+ QApplication::desktop()->numScreens() == 1) // No Ximerama
+ {
+ separateScreenFocus->hide();
+ activeMouseScreen->hide();
+ }
+
lay->addWidget(fcsBox);
kbdBox = new QButtonGroup(i18n("Navigation"), this);
@@ -260,6 +283,8 @@ KFocusConfig::KFocusConfig (bool _standAlone, KConfig *_config, QWidget * parent
connect(fcsBox, SIGNAL(clicked(int)), SLOT(changed()));
connect(autoRaise, SIGNAL(valueChanged(int)), SLOT(changed()));
connect(delayFocus, SIGNAL(valueChanged(int)), SLOT(changed()));
+ connect(separateScreenFocus, SIGNAL(clicked()), SLOT(changed()));
+ connect(activeMouseScreen, SIGNAL(clicked()), SLOT(changed()));
connect(altTabPopup, SIGNAL(clicked()), SLOT(changed()));
connect(traverseAll, SIGNAL(clicked()), SLOT(changed()));
connect(rollOverDesktops, SIGNAL(clicked()), SLOT(changed()));
@@ -366,6 +391,22 @@ void KFocusConfig::delayFocusOnTog(bool a) {
void KFocusConfig::clickRaiseOnTog(bool ) {
}
+void KFocusConfig::setSeparateScreenFocus(bool s) {
+ separateScreenFocus->setChecked(s);
+}
+
+void KFocusConfig::setActiveMouseScreen(bool a) {
+ activeMouseScreen->setChecked(a);
+}
+
+void KFocusConfig::updateActiveMouseScreen()
+{
+ // on by default for non click to focus policies
+ KConfigGroup cfg( config, "Windows" );
+ if( !cfg.hasKey( KWIN_ACTIVE_MOUSE_SCREEN ))
+ setActiveMouseScreen( focusCombo->currentItem() != 0 );
+}
+
void KFocusConfig::setAltTabMode(bool a) {
altTabPopup->setChecked(a);
}
@@ -412,6 +453,10 @@ void KFocusConfig::load( void )
setClickRaise(key != "off");
setAutoRaiseEnabled(); // this will disable/hide the auto raise delay widget if focus==click
setDelayFocusEnabled();
+
+ setSeparateScreenFocus( config->readBoolEntry(KWIN_SEPARATE_SCREEN_FOCUS, false));
+ // on by default for non click to focus policies
+ setActiveMouseScreen( config->readBoolEntry(KWIN_ACTIVE_MOUSE_SCREEN, focusCombo->currentItem() != 0 ));
key = config->readEntry(KWIN_ALTTABMODE, "KDE");
setAltTabMode(key == "KDE");
@@ -467,6 +512,9 @@ void KFocusConfig::save( void )
else
config->writeEntry(KWIN_CLICKRAISE, "off");
+ config->writeEntry(KWIN_SEPARATE_SCREEN_FOCUS, separateScreenFocus->isChecked());
+ config->writeEntry(KWIN_ACTIVE_MOUSE_SCREEN, activeMouseScreen->isChecked());
+
if (altTabPopup->isChecked())
config->writeEntry(KWIN_ALTTABMODE, "KDE");
else
@@ -500,6 +548,9 @@ void KFocusConfig::defaults()
setAutoRaise(false);
setDelayFocus(false);
setClickRaise(true);
+ setSeparateScreenFocus( false );
+ // on by default for non click to focus policies
+ setActiveMouseScreen( focusCombo->currentItem() != 0 );
setAltTabMode(true);
setTraverseAll( false );
setRollOverDesktops(true);
diff --git a/kwin/kcmkwin/kwinoptions/windows.h b/kwin/kcmkwin/kwinoptions/windows.h
index 60a4d69f0..14537b922 100644
--- a/kwin/kcmkwin/kwinoptions/windows.h
+++ b/kwin/kcmkwin/kwinoptions/windows.h
@@ -86,6 +86,7 @@ private slots:
void delayFocusOnTog(bool);
void clickRaiseOnTog(bool);
void updateAltTabMode();
+ void updateActiveMouseScreen();
void changed() { emit KCModule::changed(true); }
@@ -101,6 +102,8 @@ private:
void setDelayFocusInterval(int);
void setDelayFocus(bool);
void setClickRaise(bool);
+ void setSeparateScreenFocus(bool);
+ void setActiveMouseScreen(bool);
void setAltTabMode(bool);
void setTraverseAll(bool);
void setRollOverDesktops(bool);
@@ -113,6 +116,8 @@ private:
QCheckBox *clickRaiseOn;
KIntNumInput *autoRaise;
KIntNumInput *delayFocus;
+ QCheckBox *separateScreenFocus;
+ QCheckBox *activeMouseScreen;
QButtonGroup *kbdBox;
QCheckBox *altTabPopup;
diff --git a/kwin/kwin.kcfg b/kwin/kwin.kcfg
index 9865d296c..63749c1f8 100644
--- a/kwin/kwin.kcfg
+++ b/kwin/kwin.kcfg
@@ -60,6 +60,9 @@
+
+
+
diff --git a/kwin/kwinbindings.cpp b/kwin/kwinbindings.cpp
index 1fd8c572f..9dee0a071 100644
--- a/kwin/kwinbindings.cpp
+++ b/kwin/kwinbindings.cpp
@@ -104,6 +104,15 @@
DEF( I18N_NOOP("Window One Desktop to the Left"), 0, 0, slotWindowToDesktopLeft() );
DEF( I18N_NOOP("Window One Desktop Up"), 0, 0, slotWindowToDesktopUp() );
DEF( I18N_NOOP("Window One Desktop Down"), 0, 0, slotWindowToDesktopDown() );
+ DEF( I18N_NOOP("Window to Screen 0"), 0, 0, slotWindowToScreen(int) );
+ DEF( I18N_NOOP("Window to Screen 1"), 0, 0, slotWindowToScreen(int) );
+ DEF( I18N_NOOP("Window to Screen 2"), 0, 0, slotWindowToScreen(int) );
+ DEF( I18N_NOOP("Window to Screen 3"), 0, 0, slotWindowToScreen(int) );
+ DEF( I18N_NOOP("Window to Screen 4"), 0, 0, slotWindowToScreen(int) );
+ DEF( I18N_NOOP("Window to Screen 5"), 0, 0, slotWindowToScreen(int) );
+ DEF( I18N_NOOP("Window to Screen 6"), 0, 0, slotWindowToScreen(int) );
+ DEF( I18N_NOOP("Window to Screen 7"), 0, 0, slotWindowToScreen(int) );
+ DEF( I18N_NOOP("Window to Next Screen"), 0, 0, slotWindowToNextScreen() );
keys->insert( "Group:Desktop Switching", i18n("Desktop Switching") );
DEF( I18N_NOOP("Switch to Desktop 1"), CTRL+Qt::Key_F1, WIN+Qt::Key_F1, slotSwitchToDesktop(int) );
@@ -132,6 +141,15 @@
DEF( I18N_NOOP("Switch One Desktop to the Left"), 0, 0, slotSwitchDesktopLeft() );
DEF( I18N_NOOP("Switch One Desktop Up"), 0, 0, slotSwitchDesktopUp() );
DEF( I18N_NOOP("Switch One Desktop Down"), 0, 0, slotSwitchDesktopDown() );
+ DEF( I18N_NOOP("Switch to Screen 0"), 0, 0, slotSwitchToScreen(int) );
+ DEF( I18N_NOOP("Switch to Screen 1"), 0, 0, slotSwitchToScreen(int) );
+ DEF( I18N_NOOP("Switch to Screen 2"), 0, 0, slotSwitchToScreen(int) );
+ DEF( I18N_NOOP("Switch to Screen 3"), 0, 0, slotSwitchToScreen(int) );
+ DEF( I18N_NOOP("Switch to Screen 4"), 0, 0, slotSwitchToScreen(int) );
+ DEF( I18N_NOOP("Switch to Screen 5"), 0, 0, slotSwitchToScreen(int) );
+ DEF( I18N_NOOP("Switch to Screen 6"), 0, 0, slotSwitchToScreen(int) );
+ DEF( I18N_NOOP("Switch to Screen 7"), 0, 0, slotSwitchToScreen(int) );
+ DEF( I18N_NOOP("Switch to Next Screen"), 0, 0, slotSwitchToNextScreen() );
keys->insert( "Group:Miscellaneous", i18n("Miscellaneous") );
DEF( I18N_NOOP("Mouse Emulation"), ALT+Qt::Key_F12, 0, slotMouseEmulation() );
diff --git a/kwin/manage.cpp b/kwin/manage.cpp
index 35dcc88ba..24398dcae 100644
--- a/kwin/manage.cpp
+++ b/kwin/manage.cpp
@@ -166,7 +166,7 @@ bool Client::manage( Window w, bool isMapped )
it != mainclients.end();
++it )
{
- if( (*it)->isSpecialWindow())
+ if( mainclients.count() > 1 && (*it)->isSpecialWindow())
continue; // don't consider toolbars etc when placing
maincl = *it;
if( (*it)->isOnCurrentDesktop())
@@ -202,9 +202,14 @@ bool Client::manage( Window w, bool isMapped )
if( isMapped || session )
area = workspace()->clientArea( FullArea, geom.center(), desktop());
else if( options->xineramaPlacementEnabled )
- area = workspace()->clientArea( PlacementArea, QCursor::pos(), desktop());
+ {
+ int screen = options->xineramaPlacementScreen;
+ if( screen == -1 ) // active screen
+ screen = asn_data.xinerama() == -1 ? workspace()->activeScreen() : asn_data.xinerama();
+ area = workspace()->clientArea( PlacementArea, workspace()->screenGeometry( screen ).center(), desktop());
+ }
else
- area = workspace()->clientArea( PlacementArea, geom.center(), desktop());
+ area = workspace()->clientArea( PlacementArea, QCursor::pos(), desktop());
if( int type = checkFullScreenHack( geom ))
{
diff --git a/kwin/options.cpp b/kwin/options.cpp
index 690266fc9..f74051bbb 100644
--- a/kwin/options.cpp
+++ b/kwin/options.cpp
@@ -71,6 +71,9 @@ unsigned long Options::updateSettings()
altTabStyle = KDE; // what a default :-)
if ( val == "CDE" )
altTabStyle = CDE;
+
+ separateScreenFocus = config->readBoolEntry( "SeparateScreenFocus", false );
+ activeMouseScreen = config->readBoolEntry( "ActiveMouseScreen", focusPolicy != ClickToFocus );
rollOverDesktops = config->readBoolEntry("RollOverDesktops", TRUE);
@@ -91,9 +94,10 @@ unsigned long Options::updateSettings()
delete gc;
placement = Placement::policyFromString( config->readEntry("Placement"), true );
+ xineramaPlacementScreen = KCLAMP( config->readNumEntry( "XineramaPlacementScreen", -1 ),
+ -1, qApp->desktop()->numScreens() - 1 );
animateShade = config->readBoolEntry("AnimateShade", TRUE );
-
animateMinimize = config->readBoolEntry("AnimateMinimize", TRUE );
animateMinimizeSpeed = config->readNumEntry("AnimateMinimizeSpeed", 5 );
diff --git a/kwin/options.h b/kwin/options.h
index 59279fe80..034c9759b 100644
--- a/kwin/options.h
+++ b/kwin/options.h
@@ -124,6 +124,11 @@ class Options : public KDecorationOptions
*/
enum AltTabStyle { KDE, CDE };
AltTabStyle altTabStyle;
+
+ // whether to see Xinerama screens separately for focus (in Alt+Tab, when activating next client)
+ bool separateScreenFocus;
+ // whether active Xinerama screen is the one with mouse (or with the active window)
+ bool activeMouseScreen;
/**
* Xinerama options
@@ -133,6 +138,9 @@ class Options : public KDecorationOptions
bool xineramaMovementEnabled;
bool xineramaMaximizeEnabled;
bool xineramaFullscreenEnabled;
+
+ // number, or -1 = active screen (Workspace::activeScreen())
+ int xineramaPlacementScreen;
/**
MoveResizeMode, either Tranparent or Opaque.
diff --git a/kwin/placement.cpp b/kwin/placement.cpp
index 223b95c5b..e9ae1b95e 100644
--- a/kwin/placement.cpp
+++ b/kwin/placement.cpp
@@ -473,7 +473,7 @@ void Placement::placeOnMainWindow(Client* c, QRect& area, Policy nextPlacement )
it != mainwindows.end();
++it )
{
- if( (*it)->isSpecialWindow())
+ if( mainwindows.count() > 1 && (*it)->isSpecialWindow())
continue; // don't consider toolbars etc when placing
++mains_count;
place_on2 = *it;
@@ -502,6 +502,11 @@ void Placement::placeOnMainWindow(Client* c, QRect& area, Policy nextPlacement )
}
place_on = place_on2; // use the only window filtered together with 'mains_count'
}
+ if( place_on->isDesktop())
+ {
+ place( c, area, Centered );
+ return;
+ }
QRect geom = c->geometry();
geom.moveCenter( place_on->geometry().center());
c->move( geom.topLeft());
diff --git a/kwin/popupinfo.cpp b/kwin/popupinfo.cpp
index aef5dbea7..906489e67 100644
--- a/kwin/popupinfo.cpp
+++ b/kwin/popupinfo.cpp
@@ -25,7 +25,6 @@ License. See the file "COPYING" for the exact licensing terms.
#include
#include
#include
-#include
#include
#include
@@ -34,8 +33,8 @@ License. See the file "COPYING" for the exact licensing terms.
namespace KWinInternal
{
-PopupInfo::PopupInfo( const char *name )
- : QWidget( 0, name )
+PopupInfo::PopupInfo( Workspace* ws, const char *name )
+ : QWidget( 0, name ), workspace( ws )
{
m_infoString = "";
m_shown = false;
@@ -60,7 +59,7 @@ PopupInfo::~PopupInfo()
*/
void PopupInfo::reset()
{
- QRect r = KGlobalSettings::desktopGeometry(QCursor::pos());
+ QRect r = workspace->screenGeometry( workspace->activeScreen());
int w = fontMetrics().width( m_infoString ) + 30;
diff --git a/kwin/popupinfo.h b/kwin/popupinfo.h
index 11936fcfb..0b31846ed 100644
--- a/kwin/popupinfo.h
+++ b/kwin/popupinfo.h
@@ -24,7 +24,7 @@ class PopupInfo : public QWidget
{
Q_OBJECT
public:
- PopupInfo( const char *name=0 );
+ PopupInfo( Workspace* ws, const char *name=0 );
~PopupInfo();
void reset();
@@ -43,6 +43,7 @@ class PopupInfo : public QWidget
bool m_show;
bool m_shown;
QString m_infoString;
+ Workspace* workspace;
};
} // namespace
diff --git a/kwin/tabbox.cpp b/kwin/tabbox.cpp
index 96440e7af..29bef47b8 100644
--- a/kwin/tabbox.cpp
+++ b/kwin/tabbox.cpp
@@ -23,7 +23,6 @@ License. See the file "COPYING" for the exact licensing terms.
#include
#include
#include
-#include
#include
#include
#include
@@ -110,26 +109,36 @@ void TabBox::createClientList(ClientList &list, int desktop /*-1 = all*/, Client
while ( c )
{
+ Client* add = NULL;
if ( ((desktop == -1) || c->isOnDesktop(desktop))
&& c->wantsTabFocus() )
+ { // don't add windows that have modal dialogs
+ Client* modal = c->findModal();
+ if( modal == NULL || modal == c )
+ add = c;
+ else if( !list.contains( modal ))
+ add = modal;
+ else
+ {
+ // nothing
+ }
+ }
+
+ if( options->separateScreenFocus && options->xineramaEnabled )
{
- if ( start == c )
+ if( c->screen() != workspace()->activeScreen())
+ add = NULL;
+ }
+
+ if( add != NULL )
+ {
+ if ( start == add )
{
- list.remove( c );
- list.prepend( c );
+ list.remove( add );
+ list.prepend( add );
}
else
- { // don't add windows that have modal dialogs
- Client* modal = c->findModal();
- if( modal == NULL || modal == c )
- list += c;
- else if( !list.contains( modal ))
- list += modal;
- else
- {
- // nothing
- }
- }
+ list += add;
}
if ( chain )
@@ -156,7 +165,7 @@ void TabBox::reset()
{
int w, h, cw = 0, wmax = 0;
- QRect r = KGlobalSettings::desktopGeometry(QCursor::pos());
+ QRect r = workspace()->screenGeometry( workspace()->activeScreen());
// calculate height of 1 line
// fontheight + 1 pixel above + 1 pixel below, or 32x32 icon + 2 pixel above + below
diff --git a/kwin/useractions.cpp b/kwin/useractions.cpp
index b722bf1a1..4a431b339 100644
--- a/kwin/useractions.cpp
+++ b/kwin/useractions.cpp
@@ -482,27 +482,33 @@ bool Client::performMouseCommand( Options::MouseCommand command, QPoint globalPo
case Options::MouseActivateAndRaise:
replay = isActive(); // for clickraise mode
workspace()->takeActivity( this, ActivityFocus | ActivityRaise, handled && replay );
+ workspace()->setActiveScreenMouse( globalPos );
break;
case Options::MouseActivateAndLower:
workspace()->requestFocus( this );
workspace()->lowerClient( this );
+ workspace()->setActiveScreenMouse( globalPos );
break;
case Options::MouseActivate:
replay = isActive(); // for clickraise mode
workspace()->takeActivity( this, ActivityFocus, handled && replay );
+ workspace()->setActiveScreenMouse( globalPos );
break;
case Options::MouseActivateRaiseAndPassClick:
workspace()->takeActivity( this, ActivityFocus | ActivityRaise, handled );
+ workspace()->setActiveScreenMouse( globalPos );
replay = TRUE;
break;
case Options::MouseActivateAndPassClick:
workspace()->takeActivity( this, ActivityFocus, handled );
+ workspace()->setActiveScreenMouse( globalPos );
replay = TRUE;
break;
case Options::MouseActivateRaiseAndMove:
case Options::MouseActivateRaiseAndUnrestrictedMove:
workspace()->raiseClient( this );
workspace()->requestFocus( this );
+ workspace()->setActiveScreenMouse( globalPos );
if( options->moveMode == Options::Transparent && isMovable())
move_faked_activity = workspace()->fakeRequestedActivity( this );
// fallthrough
@@ -709,6 +715,40 @@ void Workspace::slotWindowToDesktop( int i )
sendClientToDesktop( c, i, true );
}
+void Workspace::slotSwitchToScreen( int i )
+ {
+ setCurrentScreen( i );
+ }
+
+void Workspace::slotSwitchToNextScreen()
+ {
+ slotSwitchToScreen(( activeScreen() + 1 ) % numScreens());
+ }
+
+void Workspace::slotWindowToScreen( int i )
+ {
+ Client* c = active_popup_client ? active_popup_client : active_client;
+ if( i >= 0 && i <= numScreens() && c
+ && !c->isDesktop()
+ && !c->isDock()
+ && !c->isTopMenu())
+ {
+ sendClientToScreen( c, i );
+ }
+ }
+
+void Workspace::slotWindowToNextScreen()
+ {
+ Client* c = active_popup_client ? active_popup_client : active_client;
+ if( c
+ && !c->isDesktop()
+ && !c->isDock()
+ && !c->isTopMenu())
+ {
+ sendClientToScreen( c, ( c->screen() + 1 ) % numScreens());
+ }
+ }
+
/*!
Maximizes the popup client
*/
diff --git a/kwin/utils.cpp b/kwin/utils.cpp
index b0f77df37..7c4fd00eb 100644
--- a/kwin/utils.cpp
+++ b/kwin/utils.cpp
@@ -314,7 +314,7 @@ bool isLocalMachine( const QCString& host )
hostnamebuf[sizeof(hostnamebuf)-1] = 0;
if (host == hostnamebuf)
return true;
- if( char *dot = strchr(hostnamebuf, '.'))
+ if( char *dot = (char*)strchr(hostnamebuf, '.'))
{
*dot = '\0';
if( host == hostnamebuf )
diff --git a/kwin/workspace.cpp b/kwin/workspace.cpp
index 1335a888c..2bf94c9a5 100644
--- a/kwin/workspace.cpp
+++ b/kwin/workspace.cpp
@@ -71,6 +71,7 @@ Workspace::Workspace( bool restore )
QObject (0, "workspace"),
current_desktop (0),
number_of_desktops(0),
+ active_screen (0),
active_popup( NULL ),
active_popup_client( NULL ),
desktop_widget (0),
@@ -191,7 +192,7 @@ Workspace::Workspace( bool restore )
client_keys = new KGlobalAccel( this );
initShortcuts();
tab_box = new TabBox( this );
- popupinfo = new PopupInfo( );
+ popupinfo = new PopupInfo( this );
init();
@@ -290,6 +291,7 @@ void Workspace::init()
NET::WM2ExtendedStrut |
NET::WM2KDETemporaryRules |
NET::WM2ShowingDesktop |
+ NET::WM2FullPlacement |
NET::WM2DesktopLayout |
0
,
@@ -1523,6 +1525,81 @@ void Workspace::sendClientToDesktop( Client* c, int desk, bool dont_activate )
updateClientArea();
}
+int Workspace::numScreens() const
+ {
+ if( !options->xineramaEnabled )
+ return 0;
+ return qApp->desktop()->numScreens();
+ }
+
+int Workspace::activeScreen() const
+ {
+ if( !options->xineramaEnabled )
+ return 0;
+ if( !options->activeMouseScreen )
+ {
+ if( activeClient() != NULL && !activeClient()->isOnScreen( active_screen ))
+ return qApp->desktop()->screenNumber( activeClient()->geometry().center());
+ return active_screen;
+ }
+ return qApp->desktop()->screenNumber( QCursor::pos());
+ }
+
+// check whether a client moved completely out of what's considered the active screen,
+// if yes, set a new active screen
+void Workspace::checkActiveScreen( const Client* c )
+ {
+ if( !options->xineramaEnabled )
+ return;
+ if( !c->isActive())
+ return;
+ if( !c->isOnScreen( active_screen ))
+ active_screen = c->screen();
+ }
+
+// called e.g. when a user clicks on a window, set active screen to be the screen
+// where the click occured
+void Workspace::setActiveScreenMouse( QPoint mousepos )
+ {
+ if( !options->xineramaEnabled )
+ return;
+ active_screen = qApp->desktop()->screenNumber( mousepos );
+ }
+
+QRect Workspace::screenGeometry( int screen ) const
+ {
+ if( !options->xineramaEnabled )
+ return qApp->desktop()->geometry();
+ return qApp->desktop()->screenGeometry( screen );
+ }
+
+int Workspace::screenNumber( QPoint pos ) const
+ {
+ if( !options->xineramaEnabled )
+ return 0;
+ return qApp->desktop()->screenNumber( pos );
+ }
+
+void Workspace::sendClientToScreen( Client* c, int screen )
+ {
+ if( c->screen() == screen ) // don't use isOnScreen(), that's true even when only partially
+ return;
+ GeometryUpdatesPostponer blocker( c );
+ QRect old_sarea = clientArea( MaximizeArea, c );
+ QRect sarea = clientArea( MaximizeArea, screen, c->desktop());
+ c->setGeometry( sarea.x() - old_sarea.x() + c->x(), sarea.y() - old_sarea.y() + c->y(),
+ c->size().width(), c->size().height());
+ c->checkWorkspacePosition();
+ ClientList transients_stacking_order = ensureStackingOrder( c->transients());
+ for( ClientList::ConstIterator it = transients_stacking_order.begin();
+ it != transients_stacking_order.end();
+ ++it )
+ sendClientToScreen( *it, screen );
+ if( c->isActive())
+ active_screen = screen;
+ }
+
+
void Workspace::setDesktopLayout( int, int, int )
{ // DCOP-only, unused
}
diff --git a/kwin/workspace.h b/kwin/workspace.h
index 9ccf889b4..efb31de8a 100644
--- a/kwin/workspace.h
+++ b/kwin/workspace.h
@@ -91,6 +91,7 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine
QRect clientArea( clientAreaOption, const QPoint& p, int desktop ) const;
QRect clientArea( clientAreaOption, const Client* c ) const;
+ QRect clientArea( clientAreaOption, int screen, int desktop ) const;
/**
* @internal
@@ -161,6 +162,13 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine
*/
int numberOfDesktops() const;
void setNumberOfDesktops( int n );
+
+ int activeScreen() const;
+ int numScreens() const;
+ void checkActiveScreen( const Client* c );
+ void setActiveScreenMouse( QPoint mousepos );
+ QRect screenGeometry( int screen ) const;
+ int screenNumber( QPoint pos ) const;
QWidget* desktopWidget();
@@ -186,9 +194,11 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine
void sendClientToDesktop( Client* c, int desktop, bool dont_activate );
void windowToPreviousDesktop( Client* c );
void windowToNextDesktop( Client* c );
+ void sendClientToScreen( Client* c, int screen );
// KDE4 remove me - and it's also in the DCOP interface :(
void showWindowMenuAt( unsigned long id, int x, int y );
+ void kDestopResized();
/**
* Shows the menu operations menu for the client and makes it active if
@@ -224,6 +234,7 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine
void nextDesktop();
void previousDesktop();
void circulateDesktopApplications();
+ void setCurrentScreen( int new_screen );
QString desktopName( int desk ) const;
virtual void setDesktopLayout(int , int , int );
@@ -301,6 +312,10 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine
//void slotSwitchToWindow( int );
void slotWindowToDesktop( int );
//void slotWindowToListPosition( int );
+ void slotSwitchToScreen( int );
+ void slotWindowToScreen( int );
+ void slotSwitchToNextScreen();
+ void slotWindowToNextScreen();
void slotWindowMaximize();
void slotWindowMaximizeVertical();
@@ -481,6 +496,7 @@ class Workspace : public QObject, public KWinInterface, public KDecorationDefine
int current_desktop;
int number_of_desktops;
QMemArray desktop_focus_chain;
+ int active_screen;
QWidget* active_popup;
Client* active_popup_client;
diff --git a/kxkb/extension.cpp b/kxkb/extension.cpp
index f4eee125c..405208020 100644
--- a/kxkb/extension.cpp
+++ b/kxkb/extension.cpp
@@ -4,6 +4,7 @@
#include
#include
#include
+#include
#include
#include
@@ -176,12 +177,18 @@ bool XKBExtension::setLayoutInternal(const QString& model,
if( !fullVariant.isNull() && !fullVariant.isEmpty() )
p << "-variant" << fullVariant;
- if (p.start(KProcess::Block) && p.normalExit() && (p.exitStatus() == 0)) {
- return true; //setGroup( group );
- }
- else {
- return false;
- }
+ p.start(KProcess::Block);
+
+ // reload ubuntu hotkey-setup keycode -> keysym maps
+ KProcess pXmodmap;
+ pXmodmap << "/usr/bin/xmodmap" << "/usr/share/apps/kxkb/ubuntu.xmodmap";
+ pXmodmap.start(KProcess::Block);
+
+ KProcess pXmodmapHome;
+ pXmodmapHome << "/usr/bin/xmodmap" << QDir::home().path() + "/.Xmodmap";
+ pXmodmapHome.start(KProcess::Block);
+
+ return p.normalExit() && (p.exitStatus() == 0);
}
bool XKBExtension::setGroup(unsigned int group)
diff --git a/libkonq/konq_iconviewwidget.cc b/libkonq/konq_iconviewwidget.cc
index 99d92ebde..f30873a9e 100644
--- a/libkonq/konq_iconviewwidget.cc
+++ b/libkonq/konq_iconviewwidget.cc
@@ -1848,7 +1848,7 @@ void KonqIconViewWidget::visualActivate(QIconViewItem * item)
// Adjust for scrolling (David)
rect.moveBy( -contentsX(), -contentsY() );
- KIconEffect::visualActivate(viewport(), rect);
+ KIconEffect::visualActivate(viewport(), rect, item->pixmap());
}
void KonqIconViewWidget::backgroundPixmapChange( const QPixmap & )
diff --git a/nsplugins/plugin_paths.cpp b/nsplugins/plugin_paths.cpp
index 3e8c71712..2c228ac25 100644
--- a/nsplugins/plugin_paths.cpp
+++ b/nsplugins/plugin_paths.cpp
@@ -41,6 +41,8 @@ QStringList getSearchPaths()
// keep sync with kdebase/kcontrol/konqhtml
paths.append("$HOME/.mozilla/plugins");
paths.append("$HOME/.netscape/plugins");
+ paths.append("/usr/lib/iceweasel/plugins");
+ paths.append("/usr/lib/iceape/plugins");
paths.append("/usr/lib/firefox/plugins");
paths.append("/usr/lib64/browser-plugins");
paths.append("/usr/lib/browser-plugins");
diff --git a/startkde b/startkde
index 0d8ae5e89..6c6c0a5b3 100644
--- a/startkde
+++ b/startkde
@@ -19,12 +19,21 @@ fi
# people's heads. We use colours from the standard KDE palette for those with
# palettised displays.
if test -z "$XDM_MANAGED" || echo "$XDM_MANAGED" | grep ",auto" > /dev/null; then
- xsetroot -solid "#000000"
+ xsetroot -solid "#618DCC"
fi
# we have to unset this for Darwin since it will screw up KDE's dynamic-loading
unset DYLD_FORCE_FLAT_NAMESPACE
+# Check if prelinking is enabled. If so, exporting KDE_IS_PRELINKED improves
+# loading KDE.
+if test -f /etc/default/prelink; then
+ . /etc/default/prelink
+ if [ "$PRELINKING" == yes ]; then
+ export KDE_IS_PRELINKED=1
+ fi
+fi
+
# in case we have been started with full pathname spec without being in PATH
bindir=`echo "$0" | sed -n 's,^\(/.*\)/[^/][^/]*$,\1,p'`
if [ -n "$bindir" ]; then
@@ -48,10 +57,10 @@ fi
#
# * Then ksmserver is started which takes control of the rest of the startup sequence
-# The user's personal KDE directory is usually ~/.kde, but this setting
+# The user's personal KDE directory is usually ~/.kde3, but this setting
# may be overridden by setting KDEHOME.
-kdehome=$HOME/.kde
+export KDEHOME=$HOME/.kde3 && export PATH=/opt/kde3/bin:/opt/kde3/games:$PATH && export KDEDIRS=/usr/:/opt/kde3/ && export XDG_DATA_DIRS=/opt/kde3/share/:/usr/share/ && export XDG_CONFIG_DIRS=/opt/kde3/etc/xdg/:/etc/xdg/ && export MANPATH=/opt/kde3/share/man:$MANPATH && export DESKTOP_SESSION=kde3
test -n "$KDEHOME" && kdehome=`echo "$KDEHOME"|sed "s,^~/,$HOME/,"`
# see kstartupconfig source for usage
@@ -160,8 +169,22 @@ Xft.dpi: 96
EOF
fi
+# configuration of the gtk_qt_engine if not already set
+
+if [ ! -e $kdehome/env/gtk-qt-engine.rc.sh ] && [ -e /usr/share/kubuntu-default-settings/gtk-qt-engine.rc.sh ]
+then
+ mkdir -p $kdehome/env
+ cp -f /usr/share/kubuntu-default-settings/gtk-qt-engine.rc.sh $kdehome/env
+ chmod 755 $kdehome/env/gtk-qt-engine.rc.sh
+fi
+
+if [ ! -e $HOME/.gtkrc-2.0-kde ] && [ -e /usr/share/kubuntu-default-settings/.gtkrc-2.0-kde ]
+then
+ cp -f /usr/share/kubuntu-default-settings/.gtkrc-2.0-kde $HOME
+fi
+
# Source scripts found in /env/*.sh and /env/*.sh
-# (where is $KDEHOME or ~/.kde, and is where KDE is installed)
+# (where is $KDEHOME or ~/.kde3, and is where KDE is installed)
#
# This is where you can define environment variables that will be available to
# all KDE programs, so this is where you can run agents using e.g. eval `ssh-agent`
@@ -287,17 +310,26 @@ echo 'startkde: Starting up...' 1>&2
# run KPersonalizer before the session, if this is the first login
if test "$kpersonalizerrc_general_firstlogin" = "true"; then
- # start only dcopserver, don't start whole kdeinit (takes too long)
- echo 'startkde: Running kpersonalizer...' 1>&2
- dcopserver
- kwin --lock &
- kpersonalizer --before-session
- # handle kpersonalizer restarts (language change)
- while test $? -eq 1; do
- kpersonalizer --r --before-session
- done
- dcopquit kwin
- dcopserver_shutdown --wait
+ if [ ! -x /opt/kde3/bin/kpersonalizer ]; then
+ echo 'startkde: kpersonalizer not found! Please install to properly configure your user.' 1>&2
+ else
+ # start only dcopserver, don't start whole kdeinit (takes too long)
+ echo 'startkde: Running kpersonalizer...' 1>&2
+ dcopserver
+ kwin --lock &
+ kpersonalizer --before-session
+ # handle kpersonalizer restarts (language change)
+ while test $? -eq 1; do
+ kpersonalizer --r --before-session
+ done
+ dcopquit kwin
+ dcopserver_shutdown --wait
+ fi
+fi
+
+#remove moodin cache if we have a new wallpaper installed, jriddell
+if [ /usr/share/wallpapers/kubuntu-wallpaper.png -nt $kdehome/share/apps/ksplash/cache/Moodin/kubuntu/ ]; then
+ rm -rf $kdehome/share/apps/ksplash/cache/Moodin/kubuntu/;
fi
if test -z "$dl"; then
@@ -358,6 +390,15 @@ if test -n "$dl"; then
sleep 1
fi
+# configuration of kwalletmanager if not already set
+
+if [ ! -e $kdehome/share/config/kwalletrc ] && [ -e /usr/share/kubuntu-default-settings/kde-profile/default/share/config/kwalletrc ]
+then
+ mkdir -p "$kdehome/share/config/"
+ cp -f /usr/share/kubuntu-default-settings/kde-profile/default/share/config/kwalletrc $kdehome/share/config/
+fi
+
+
# finally, give the session control to the session manager
# see kdebase/ksmserver for the description of the rest of the startup sequence
# if the KDEWM environment variable has been set, then it will be used as KDE's