diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-12-11 20:21:27 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-12-11 20:21:27 +0000 |
commit | 10e41144596fc9ced40fc349d9ecd099b1c2ea19 (patch) | |
tree | 88ab04e475ff5a4cd889cb082f5760b6e0bf5e4e /kcontrol | |
parent | 4aed2c8219774f5d797760606b8489a92ddc5163 (diff) | |
download | tdebase-10e41144596fc9ced40fc349d9ecd099b1c2ea19.tar.gz tdebase-10e41144596fc9ced40fc349d9ecd099b1c2ea19.zip |
Initial import of Trinity 3.5.11 to kdebase
Extends krandrtray, adds iccconfig kcontrol module, adds run dialog autocomplete and lots of bugfixes
Will need to check for commit warnings and repair as encountered
Also needs full compile test
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1061475 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kcontrol')
71 files changed, 2895 insertions, 363 deletions
diff --git a/kcontrol/Makefile.am b/kcontrol/Makefile.am index 50e8242de..d1fe576ac 100644 --- a/kcontrol/Makefile.am +++ b/kcontrol/Makefile.am @@ -11,6 +11,10 @@ if include_kcontrol_smartcard KSMCARD_SUBDIR=smartcard endif +if include_kcontrol_iccconfig +ICCCONFIG_SUBDIR=iccconfig +endif + if include_kcontrol_usbview USBVIEW_SUBDIR=usbview endif @@ -36,4 +40,4 @@ SUBDIRS = bell background dnssd filetypes samba krdb input info ioslaveinfo kdm\ konsole spellchecking $(USBVIEW_SUBDIR) \ $(KSMCARD_SUBDIR) nics $(FONTINST_SUBDIR) $(RANDR_SUBDIR) \ componentchooser performance xinerama $(VIEW1394_SUBDIR) display kthememanager \ - $(JOYSTICK_SUBDIR) + $(JOYSTICK_SUBDIR) $(ICCCONFIG_SUBDIR) diff --git a/kcontrol/background/bgdialog.cpp b/kcontrol/background/bgdialog.cpp index 398e30d56..34cff9f53 100644 --- a/kcontrol/background/bgdialog.cpp +++ b/kcontrol/background/bgdialog.cpp @@ -53,6 +53,7 @@ #include <kstringhandler.h> #include <kurlrequester.h> #include <kwin.h> +#include <kwinmodule.h> #include <kimagefilepreview.h> #include <knewstuff/downloaddialog.h> @@ -73,7 +74,14 @@ BGDialog::BGDialog(QWidget* parent, KConfig* _config, bool _multidesktop) m_multidesktop = _multidesktop; m_previewUpdates = true; + KWinModule *m_kwin; + m_kwin = new KWinModule(this); + m_curDesk = m_kwin->currentDesktop(); + QSize s(m_kwin->numberOfViewports(m_kwin->currentDesktop())); + m_useViewports = s.width() * s.height() > 1; + m_numDesks = m_multidesktop ? KWin::numberOfDesktops() : 1; + m_numViewports = s.width() * s.height(); m_numScreens = QApplication::desktop()->numScreens(); QCString multiHead = getenv("KDE_MULTIHEAD"); @@ -81,8 +89,19 @@ BGDialog::BGDialog(QWidget* parent, KConfig* _config, bool _multidesktop) { m_numScreens = 1; } + + QPoint vx(m_kwin->currentViewport(m_kwin->currentDesktop())); + int t_eViewport = (vx.x() * vx.y()); + if (t_eViewport < 1) { + t_eViewport = 1; + } + delete m_kwin; m_desk = m_multidesktop ? KWin::currentDesktop() : 1; + //m_desk = m_multidesktop ? (m_useViewports ? (m_desk * m_numViewports) : m_desk) : m_desk; + m_desk = m_multidesktop ? (m_useViewports ? (((m_desk - 1) * m_numViewports) + t_eViewport) : m_desk) : m_desk; + m_numDesks = m_multidesktop ? (m_useViewports ? (m_numDesks * m_numViewports) : m_numDesks) : m_numDesks; + m_screen = QApplication::desktop()->screenNumber(this); if (m_screen >= (int)m_numScreens) m_screen = m_numScreens-1; @@ -416,8 +435,18 @@ void BGDialog::slotIdentifyScreens() void BGDialog::initUI() { // Desktop names - for (unsigned i = 0; i < m_numDesks; ++i) - m_comboDesktop->insertItem(m_pGlobals->deskName(i)); + if (m_useViewports == false) { + for (unsigned i = 0; i < m_numDesks; ++i) { + m_comboDesktop->insertItem(m_pGlobals->deskName(i)); + } + } + else { + for (unsigned i = 0; i < (m_numDesks/m_numViewports); ++i) { + for (unsigned j = 0; j < m_numViewports; ++j) { + m_comboDesktop->insertItem(i18n("Desktop %1 Viewport %2").arg(i+1).arg(j+1)); + } + } + } // Screens for (unsigned i = 0; i < m_numScreens; ++i) diff --git a/kcontrol/background/bgdialog.h b/kcontrol/background/bgdialog.h index 02fbf3f3a..8782b73f7 100644 --- a/kcontrol/background/bgdialog.h +++ b/kcontrol/background/bgdialog.h @@ -86,8 +86,10 @@ protected: KGlobalBackgroundSettings *m_pGlobals; KStandardDirs *m_pDirs; bool m_multidesktop; - + bool m_useViewports; + int m_curDesk; unsigned m_numDesks; + unsigned m_numViewports; unsigned m_numScreens; int m_desk; int m_screen; diff --git a/kcontrol/background/bgrender.cpp b/kcontrol/background/bgrender.cpp index f17892dce..47d52b193 100644 --- a/kcontrol/background/bgrender.cpp +++ b/kcontrol/background/bgrender.cpp @@ -54,8 +54,7 @@ KBackgroundRenderer::KBackgroundRenderer(int desk, int screen, bool drawBackgrou m_isBusyCursor = false; m_enableBusyCursor = false; m_pDirs = KGlobal::dirs(); - m_rSize = m_Size = drawBackgroundPerScreen ? - QApplication::desktop()->screenGeometry(screen).size() : QApplication::desktop()->size(); + m_rSize = m_Size = drawBackgroundPerScreen ? KApplication::desktop()->screenGeometry(screen).size() : KApplication::desktop()->geometry().size(); m_pProc = 0L; m_Tempfile = 0L; m_bPreview = false; @@ -86,8 +85,7 @@ void KBackgroundRenderer::setSize(const QSize &size) void KBackgroundRenderer::desktopResized() { m_State = 0; - m_rSize = drawBackgroundPerScreen() ? - QApplication::desktop()->screenGeometry(screen()).size() : QApplication::desktop()->size(); + m_rSize = drawBackgroundPerScreen() ? KApplication::desktop()->screenGeometry(screen()).size() : KApplication::desktop()->geometry().size(); if( !m_bPreview ) m_Size = m_rSize; } @@ -1048,7 +1046,7 @@ KVirtualBGRenderer::KVirtualBGRenderer( int desk, KConfig *config ) } initRenderers(); - m_size = QApplication::desktop()->size(); + m_size = KApplication::desktop()->geometry().size(); } KVirtualBGRenderer::~KVirtualBGRenderer() @@ -1155,7 +1153,7 @@ void KVirtualBGRenderer::setEnabled(bool enable) void KVirtualBGRenderer::desktopResized() { - m_size = QApplication::desktop()->size(); + m_size = KApplication::desktop()->geometry().size(); if (m_pPixmap) { @@ -1164,7 +1162,7 @@ void KVirtualBGRenderer::desktopResized() m_pPixmap->fill(Qt::black); } - initRenderers(); + initRenderers(); } @@ -1196,8 +1194,7 @@ void KVirtualBGRenderer::setPreview(const QSize & size) QSize KVirtualBGRenderer::renderSize(int screen) { - return m_bDrawBackgroundPerScreen ? - QApplication::desktop()->screenGeometry(screen).size() : QApplication::desktop()->size(); + return m_bDrawBackgroundPerScreen ? KApplication::desktop()->screenGeometry(screen).size() : KApplication::desktop()->geometry().size(); } @@ -1208,7 +1205,7 @@ void KVirtualBGRenderer::initRenderers() m_bCommonScreen = m_pConfig->readBoolEntry("CommonScreen", _defCommonScreen); - m_numRenderers = m_bDrawBackgroundPerScreen ? QApplication::desktop()->numScreens() : 1; + m_numRenderers = m_bDrawBackgroundPerScreen ? KApplication::desktop()->numScreens() : 1; m_bFinished.resize(m_numRenderers); m_bFinished.fill(false); @@ -1267,10 +1264,11 @@ void KVirtualBGRenderer::screenDone(int _desk, int _screen) // There's more than one renderer, so we are drawing each output to our own pixmap QRect overallGeometry; - for (int i=0; i < QApplication::desktop()->numScreens(); ++i) - overallGeometry |= QApplication::desktop()->screenGeometry(i); + for (int i=0; i < KApplication::desktop()->numScreens(); ++i) { + overallGeometry |= KApplication::desktop()->screenGeometry(i); + } - QPoint drawPos = QApplication::desktop()->screenGeometry(screen).topLeft() - overallGeometry.topLeft(); + QPoint drawPos = KApplication::desktop()->screenGeometry(screen).topLeft() - overallGeometry.topLeft(); drawPos.setX( int(drawPos.x() * m_scaleX) ); drawPos.setY( int(drawPos.y() * m_scaleY) ); diff --git a/kcontrol/dnssd/configdialog.ui b/kcontrol/dnssd/configdialog.ui index 83808d1bb..848457a44 100644 --- a/kcontrol/dnssd/configdialog.ui +++ b/kcontrol/dnssd/configdialog.ui @@ -44,45 +44,17 @@ <attribute name="title"> <string>&General</string> </attribute> - <vbox> + <grid> <property name="name"> <cstring>unnamed</cstring> </property> - <widget class="QCheckBox"> - <property name="name"> - <cstring>kcfg_BrowseLocal</cstring> - </property> - <property name="text"> - <string>Browse local networ&k</string> - </property> - <property name="whatsThis" stdset="0"> - <string>Browse local network (domain .local) using multicast DNS.</string> - </property> - </widget> - <widget class="KEditListBox"> - <property name="name"> - <cstring>kcfg_DomainList</cstring> - </property> - <property name="sizePolicy"> - <sizepolicy> - <hsizetype>7</hsizetype> - <vsizetype>7</vsizetype> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>Additional Domains</string> - </property> - <property name="whatsThis" stdset="0"> - <string>List of Internet domains that will be browsed for services. Do not put .local here - it -is configured with 'Browse local network' option above.</string> - </property> - </widget> - <widget class="QButtonGroup"> + <widget class="QButtonGroup" row="3" column="0"> <property name="name"> <cstring>kcfg_PublishType</cstring> </property> + <property name="enabled"> + <bool>true</bool> + </property> <property name="sizePolicy"> <sizepolicy> <hsizetype>5</hsizetype> @@ -96,50 +68,104 @@ is configured with 'Browse local network' option above.</string> </property> <widget class="QRadioButton"> <property name="name"> - <cstring>LANButtor</cstring> + <cstring>WANButton</cstring> + </property> + <property name="enabled"> + <bool>true</bool> </property> <property name="geometry"> <rect> <x>11</x> - <y>23</y> + <y>51</y> <width>618</width> <height>22</height> </rect> </property> <property name="text"> - <string>Loc&al network</string> + <string>&Wide area network</string> </property> - <property name="checked"> - <bool>false</bool> + <property name="accel"> + <string>Alt+W</string> </property> <property name="whatsThis" stdset="0"> - <string>Advertise services on local network (in domain .local) using multicast DNS.</string> + <string>Advertise services on Internet domain using public IP. To have this option working you need to configure wide area operation in using administrator mode</string> </property> </widget> <widget class="QRadioButton"> <property name="name"> - <cstring>WANButton</cstring> - </property> - <property name="enabled"> - <bool>true</bool> + <cstring>LANButtor</cstring> </property> <property name="geometry"> <rect> <x>11</x> - <y>51</y> + <y>23</y> <width>618</width> <height>22</height> </rect> </property> <property name="text"> - <string>&Wide area network</string> + <string>Loc&al network</string> + </property> + <property name="accel"> + <string>Alt+A</string> + </property> + <property name="checked"> + <bool>false</bool> </property> <property name="whatsThis" stdset="0"> - <string>Advertise services on Internet domain using public IP. To have this option working you need to configure wide area operation in using administrator mode</string> + <string>Advertise services on local network (in domain .local) using multicast DNS.</string> </property> </widget> </widget> - </vbox> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>kcfg_BrowseLocal</cstring> + </property> + <property name="text"> + <string>Browse local networ&k</string> + </property> + <property name="accel"> + <string>Alt+K</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Browse local network (domain .local) using multicast DNS.</string> + </property> + </widget> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>enableZeroconf</cstring> + </property> + <property name="text"> + <string>Enable &Zeroconf network browsing</string> + </property> + <property name="accel"> + <string>Alt+Z</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Browse local network (domain .local) using multicast DNS.</string> + </property> + </widget> + <widget class="KEditListBox" row="2" column="0"> + <property name="name"> + <cstring>kcfg_DomainList</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Additional Domains</string> + </property> + <property name="whatsThis" stdset="0"> + <string>List of Internet domains that will be browsed for services. Do not put .local here - it +is configured with 'Browse local network' option above.</string> + </property> + </widget> + </grid> </widget> <widget class="QWidget"> <property name="name"> diff --git a/kcontrol/dnssd/kcm_kdnssd.desktop b/kcontrol/dnssd/kcm_kdnssd.desktop index 8b949e370..b0d731098 100644 --- a/kcontrol/dnssd/kcm_kdnssd.desktop +++ b/kcontrol/dnssd/kcm_kdnssd.desktop @@ -70,9 +70,9 @@ Comment[zh_TW]=設定服務偵測 Exec=kcmshell kcm_kdnssd GenericName= GenericName[ko]=일반 -Icon=blockdevice +Icon=network_local MimeType= -Name=Service Discovery +Name=Zeroconf Service Discovery Name[af]=Dienste ontdekker Name[ar]=إكتشاف الخدمات Name[be]=Пошук сервісаў @@ -149,6 +149,7 @@ X-KDE-HasReadOnlyMode=false X-KDE-Library=kdnssd X-KDE-ModuleType=Library X-KDE-ParentApp=kcontrol -X-KDE-SubstituteUID=false -X-KDE-RootOnly=true +#root parts unused with Avahi +#X-KDE-SubstituteUID=false +#X-KDE-RootOnly=true Categories=Qt;KDE;X-KDE-settings-network; diff --git a/kcontrol/dnssd/kcmdnssd.cpp b/kcontrol/dnssd/kcmdnssd.cpp index d86cc2897..d754f0025 100644 --- a/kcontrol/dnssd/kcmdnssd.cpp +++ b/kcontrol/dnssd/kcmdnssd.cpp @@ -27,6 +27,10 @@ #include <qradiobutton.h> #include <qtimer.h> #include <qtabwidget.h> +#include <qcheckbox.h> +#include <qprocess.h> +#include <qcursor.h> +#include <qbuttongroup.h> #include <klocale.h> #include <kglobal.h> @@ -35,6 +39,8 @@ #include <klineedit.h> #include <kpassdlg.h> #include <ksimpleconfig.h> +#include <kapplication.h> +#include <kmessagebox.h> #include "kcmdnssd.h" #include <dnssd/settings.h> @@ -65,7 +71,10 @@ KCMDnssd::KCMDnssd(QWidget *parent, const char *name, const QStringList&) connect(hostedit,SIGNAL(textChanged(const QString&)),this,SLOT(wdchanged())); connect(secretedit,SIGNAL(textChanged(const QString&)),this,SLOT(wdchanged())); connect(domainedit,SIGNAL(textChanged(const QString&)),this,SLOT(wdchanged())); + connect(enableZeroconf,SIGNAL(toggled(bool)),this,SLOT(enableZeroconfChanged(bool))); + m_enableZeroconfChanged=false; if (DNSSD::Configuration::self()->publishDomain().isEmpty()) WANButton->setEnabled(false); + kcfg_PublishType->hide(); //unused with Avahi } KCMDnssd::~KCMDnssd() @@ -75,18 +84,55 @@ KCMDnssd::~KCMDnssd() void KCMDnssd::save() { + setCursor(QCursor(Qt::BusyCursor)); KCModule::save(); if (geteuid()==0 && m_wdchanged) saveMdnsd(); domain->setFileWriteMode(0644); // this should be readable for everyone domain->writeEntry("PublishDomain",domainedit->text()); domain->sync(); KIPC::sendMessageAll((KIPC::Message)KIPCDomainsChanged); + if (m_enableZeroconfChanged) { + + QString scaryMessage = i18n("Enabling local network browsing will open a network port (5353) on your computer. If security problems are discovered in the zeroconf server, remote attackers could access your computer as the \"avahi\" user."); + + KProcess *proc = new KProcess; + + *proc << "kdesu"; + + if (enableZeroconf->isChecked()) { + if (KMessageBox::warningYesNo( this, scaryMessage, i18n("Enable Zeroconf Network Browsing"), KGuiItem(i18n("Enable Browsing")), KGuiItem(i18n("Don't Enable Browsing")) ) == KMessageBox::Yes) { + + *proc << "/usr/share/avahi/enable_avahi 1"; + proc->start(KProcess::Block); + } else { + enableZeroconf->setChecked(false); + } + } else { + *proc << "/usr/share/avahi/enable_avahi 0"; + proc->start(KProcess::Block); + } + } + setCursor(QCursor(Qt::ArrowCursor)); } void KCMDnssd::load() { - KCModule::load(); if (geteuid()==0) loadMdnsd(); + enableZeroconf->setChecked(false); + QProcess avahiStatus(QString("/usr/share/avahi/avahi_status"), this, "avahiStatus"); + avahiStatus.start(); + while (avahiStatus.isRunning()) { + kapp->processEvents(); + } + int exitStatus = avahiStatus.exitStatus(); + if (exitStatus == 0) { // disabled + enableZeroconf->setChecked(false); + } else if (exitStatus == 1) { // enabled + enableZeroconf->setChecked(true); + } else if (exitStatus == 2) { // custom setup + enableZeroconf->setEnabled(false); + } + KCModule::load(); } // hack to work around not working isModified() for KPasswordEdit @@ -97,6 +143,12 @@ void KCMDnssd::wdchanged() m_wdchanged=true; } +void KCMDnssd::enableZeroconfChanged(bool) +{ + changed(); + m_enableZeroconfChanged=true; +} + void KCMDnssd::loadMdnsd() { QFile f(MDNSD_CONF); diff --git a/kcontrol/dnssd/kcmdnssd.h b/kcontrol/dnssd/kcmdnssd.h index 2e66f6a8f..384f7b625 100644 --- a/kcontrol/dnssd/kcmdnssd.h +++ b/kcontrol/dnssd/kcmdnssd.h @@ -38,12 +38,14 @@ public: virtual void load(); private slots: void wdchanged(); + void enableZeroconfChanged(bool); private: void loadMdnsd(); bool saveMdnsd(); QMap<QString,QString> mdnsdLines; bool m_wdchanged; KSimpleConfig* domain; + bool m_enableZeroconfChanged; }; #endif diff --git a/kcontrol/ebrowsing/plugins/ikws/ikwsopts.cpp b/kcontrol/ebrowsing/plugins/ikws/ikwsopts.cpp index 6c055255d..ca79f0b36 100644 --- a/kcontrol/ebrowsing/plugins/ikws/ikwsopts.cpp +++ b/kcontrol/ebrowsing/plugins/ikws/ikwsopts.cpp @@ -164,6 +164,9 @@ void FilterOptions::load( bool useDefaults ) this, SLOT(checkFavoritesChanged())); connect(m_dlg->lvSearchProviders, SIGNAL(pressed(QListViewItem *)), this, SLOT(checkFavoritesChanged())); + connect(m_dlg->lvSearchProviders, SIGNAL(clicked(QListViewItem *)), + this, SLOT(checkFavoritesChanged())); + connect(m_dlg->cmbDefaultEngine, SIGNAL(activated(const QString &)), this, SLOT(configChanged())); diff --git a/kcontrol/ebrowsing/plugins/ikws/searchproviders/kde.desktop b/kcontrol/ebrowsing/plugins/ikws/searchproviders/kde.desktop index f5a96f71e..961b236be 100644 --- a/kcontrol/ebrowsing/plugins/ikws/searchproviders/kde.desktop +++ b/kcontrol/ebrowsing/plugins/ikws/searchproviders/kde.desktop @@ -74,7 +74,6 @@ Name[vi]=Tài liệu về API của KDE Name[wa]=Documintåcion di l' API di KDE Name[zh_CN]=KDE API 文档 Name[zh_TW]=KDE API 文件 -Query=http://developer.kde.org/documentation/library/classmapper.php?class=\\{@} -Query[bg]=http://developer.kde.org/documentation/library/classmapper.php?class=\ +Query=http://api.kde.org/classmapper.php?class=\\{@} ServiceTypes=SearchProvider Type=Service diff --git a/kcontrol/fonts/fonts.cpp b/kcontrol/fonts/fonts.cpp index 8cb1cbafc..c50c89bc9 100644 --- a/kcontrol/fonts/fonts.cpp +++ b/kcontrol/fonts/fonts.cpp @@ -331,7 +331,7 @@ bool FontAASettings::load( bool useDefaults ) kglobals.setReadDefaults( useDefaults ); kglobals.setGroup("General"); - hStyle=KXftConfig::Hint::Medium; + hStyle=KXftConfig::Hint::Full; xft.setHintStyle(hStyle); xft.apply(); // Save this setting kglobals.writeEntry("XftHintStyle", KXftConfig::toStr(hStyle)); @@ -449,7 +449,7 @@ KXftConfig::Hint::Style FontAASettings::getHintStyle() if(hintingStyle->currentText()==KXftConfig::description((KXftConfig::Hint::Style)s)) return (KXftConfig::Hint::Style)s; - return KXftConfig::Hint::Medium; + return KXftConfig::Hint::Full; } #endif @@ -527,13 +527,13 @@ KFonts::KFonts(QWidget *parent, const char *name, const QStringList &) QFont f0("Sans Serif", 10); QFont f1("Monospace", 10); QFont f2("Sans Serif", 10); - QFont f3("Sans Serif", 9, QFont::Bold); + QFont f3("Sans Serif", 10, QFont::Bold); QFont f4("Sans Serif", 10); f0.setPointSize(10); f1.setPointSize(10); f2.setPointSize(10); - f3.setPointSize(9); + f3.setPointSize(10); f4.setPointSize(10); defaultFontList << f0 << f1 << f2 << f0 << f3 << f4 << f0; diff --git a/kcontrol/fonts/kxftconfig.cpp b/kcontrol/fonts/kxftconfig.cpp index 833e31118..22621f5e6 100644 --- a/kcontrol/fonts/kxftconfig.cpp +++ b/kcontrol/fonts/kxftconfig.cpp @@ -1147,7 +1147,7 @@ void KXftConfig::readContents() if(*ptr=='\"') { ptr++; - if(NULL!=(eostr=strchr(ptr, '\"')) && eostr-ptr<constMaxDataLen) + if(NULL!=(eostr=(char*)strchr(ptr, '\"')) && eostr-ptr<constMaxDataLen) { memcpy(data, ptr, eostr-ptr); data[eostr-ptr]='\0'; @@ -1183,7 +1183,7 @@ void KXftConfig::readContents() if(*ptr=='\"') { ptr++; - if(NULL!=(eostr=strchr(ptr, '\"')) && eostr-ptr<constMaxDataLen) + if(NULL!=(eostr=(char*)strchr(ptr, '\"')) && eostr-ptr<constMaxDataLen) { memcpy(data, ptr, eostr-ptr); data[eostr-ptr]='\0'; diff --git a/kcontrol/iccconfig/Makefile.am b/kcontrol/iccconfig/Makefile.am new file mode 100644 index 000000000..8ebd2b289 --- /dev/null +++ b/kcontrol/iccconfig/Makefile.am @@ -0,0 +1,17 @@ +AM_CPPFLAGS = $(all_includes) +kde_module_LTLIBRARIES = kcm_iccconfig.la + +kcm_iccconfig_la_SOURCES = iccconfig.cpp iccconfigbase.ui iccconfig.skel + +kcm_iccconfig_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined + +kcm_iccconfig_la_LIBADD = -lkdeui $(LIB_KIO) + +METASOURCES = AUTO + +noinst_HEADERS = iccconfig.h + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kcmiccconfig.pot + +xdg_apps_DATA = iccconfig.desktop diff --git a/kcontrol/iccconfig/configure.in.in b/kcontrol/iccconfig/configure.in.in new file mode 100644 index 000000000..a98dfc1b2 --- /dev/null +++ b/kcontrol/iccconfig/configure.in.in @@ -0,0 +1,7 @@ +case "$host" in + *-*-linux*) + FOUND_LINUX=yes + ;; +esac + +AM_CONDITIONAL(include_kcontrol_iccconfig, test "$FOUND_LINUX" = "yes")
\ No newline at end of file diff --git a/kcontrol/iccconfig/iccconfig.cpp b/kcontrol/iccconfig/iccconfig.cpp new file mode 100644 index 000000000..36eb20593 --- /dev/null +++ b/kcontrol/iccconfig/iccconfig.cpp @@ -0,0 +1,166 @@ +/** + * smartcard.cpp + * + * Copyright (c) 2001 George Staikos <[email protected]> + * Copyright (c) 2001 Fernando Llobregat <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "iccconfig.h" + +#include <qcheckbox.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qlineedit.h> +#include <qpushbutton.h> + +#include <dcopclient.h> + +#include <kaboutdata.h> +#include <kapplication.h> +#include <kconfig.h> +#include <kdebug.h> +#include <kdialog.h> +#include <kglobal.h> +#include <klistview.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <kpopupmenu.h> +#include <kurlrequester.h> +#include <kgenericfactory.h> + +#include <unistd.h> +#include <ksimpleconfig.h> +#include <string> +#include <stdio.h> +#include <qstring.h> + +using namespace std; + +/**** DLL Interface ****/ +typedef KGenericFactory<KICCConfig, QWidget> KICCCFactory; +K_EXPORT_COMPONENT_FACTORY( kcm_iccconfig, KICCCFactory("kcmiccconfig") ) + +KSimpleConfig *config; + +/**** KICCConfig ****/ + +KICCConfig::KICCConfig(QWidget *parent, const char *name, const QStringList &) + : KCModule(KICCCFactory::instance(), parent, name) +{ + + QVBoxLayout *layout = new QVBoxLayout(this, KDialog::marginHint(), KDialog::spacingHint()); + config = new KSimpleConfig( QString::fromLatin1( KDE_CONFDIR "/kicc/kiccconfigrc" )); + + KAboutData *about = + new KAboutData(I18N_NOOP("kcmiccconfig"), I18N_NOOP("KDE ICC Profile Control Module"), + 0, 0, KAboutData::License_GPL, + I18N_NOOP("(c) 2009 Timothy Pearson")); + + about->addAuthor("Timothy Pearson", 0, "[email protected]"); + setAboutData( about ); + + base = new ICCConfigBase(this); + layout->add(base); + + setRootOnlyMsg(i18n("<b>The ICC color profile is a system wide setting, and requires administrator access</b><br>To alter the system's ICC profile, click on the \"Administrator Mode\" button below.")); + setUseRootOnlyMsg(true); + + connect(base->enableSupport, SIGNAL(clicked()), SLOT(changed())); + connect(base->enableSupport, SIGNAL(toggled(bool)), base->iccFile, SLOT(setEnabled(bool))); + + connect(base->iccFile, SIGNAL(textChanged(const QString&)), SLOT(changed())); + + load(); + + if (getuid() != 0 || !config->checkConfigFilesWritable( true )) { + base->enableSupport->setEnabled(false); + base->iccFile->setEnabled(false); + } +} + +KICCConfig::~KICCConfig() +{ + delete config; +} + +void KICCConfig::load() +{ + load( false ); +} + +void KICCConfig::load(bool useDefaults ) +{ + //Update the toggle buttons with the current configuration + + config->setReadDefaults( useDefaults ); + + base->enableSupport->setChecked(config->readBoolEntry("EnableICC", false)); + base->iccFile->setEnabled(config->readBoolEntry("EnableICC", false)); + base->iccFile->setURL(config->readEntry("ICCFile")); + + emit changed(useDefaults); +} + +void KICCConfig::save() +{ + config->writeEntry("EnableICC", base->enableSupport->isChecked()); + config->writeEntry("ICCFile", base->iccFile->url()); + + if (base->enableSupport->isChecked()) { + // Apply ICC settings with XCalib + string icc_command="/usr/bin/xcalib "; + FILE *pipe_xcalib; + char xcalib_result[2048]; + int i; + xcalib_result[0]=0; + + icc_command.append(base->iccFile->url().ascii()); + if ((pipe_xcalib = popen(icc_command.c_str(), "r")) == NULL) + { + printf("Xcalib pipe error\n\r"); + } + else { + fgets(xcalib_result, 2048, pipe_xcalib); + pclose(pipe_xcalib); + for (i=1;i<2048;i++) { + if (xcalib_result[i] == 0) { + xcalib_result[i-1]=0; + i=2048; + } + } + if (strlen(xcalib_result) > 2) { + KMessageBox::error(this, QString("Unable to apply ICC configuration:\n\r%1").arg(xcalib_result)); + } + } + } + + emit changed(false); +} + +void KICCConfig::defaults() +{ + load( true ); +} + +QString KICCConfig::quickHelp() const +{ + return i18n("<h1>ICC Profile Configuration</h1> This module allows you to configure KDE support" + " for ICC profiles. This allows you to easily color correct your monitor" + " for a more lifelike and vibrant image."); +} + +#include "iccconfig.moc"
\ No newline at end of file diff --git a/kcontrol/iccconfig/iccconfig.desktop b/kcontrol/iccconfig/iccconfig.desktop new file mode 100644 index 000000000..97f1b5a9d --- /dev/null +++ b/kcontrol/iccconfig/iccconfig.desktop @@ -0,0 +1,21 @@ +[Desktop Entry] +Exec=kcmshell iccconfig +Icon=kcoloredit +Type=Application +DocPath=kcontrol/iccconfig/index.html + +X-KDE-Library=iccconfig +X-KDE-ParentApp=kcontrol +X-KDE-RootOnly=true +X-KDE-SubstituteUID=true + +Categories=Qt;KDE;X-KDE-settings-peripherals; +Comment=Configure display ICC profile +Comment[en_US]=Configure display ICC profile +DocPath=kcontrol/iccconfig.html +GenericName= +GenericName[en_US]= +Keywords=ICC,display,color,profile +MimeType= +Name=ICC Color Profile +Name[en_US]=ICC Color Profile
\ No newline at end of file diff --git a/kcontrol/iccconfig/iccconfig.h b/kcontrol/iccconfig/iccconfig.h new file mode 100644 index 000000000..0736968b4 --- /dev/null +++ b/kcontrol/iccconfig/iccconfig.h @@ -0,0 +1,71 @@ +/** + * iccconfig.h + * + * Copyright (c) 2009 Timothy Pearson <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef _KCM_ICCCONFIG_H +#define _KCM_ICCCONFIG_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <dcopobject.h> + +#include <kcmodule.h> + +#include "iccconfigbase.h" + +class KConfig; +class KPopupMenu; +class KListViewItem; + +class KICCConfig : public KCModule, public DCOPObject +{ + K_DCOP + Q_OBJECT + + +public: + //KICCConfig(QWidget *parent = 0L, const char *name = 0L); + KICCConfig(QWidget *parent, const char *name, const QStringList &); + virtual ~KICCConfig(); + + ICCConfigBase *base; + + void load(); + void load( bool useDefaults); + void save(); + void defaults(); + + int buttons(); + QString quickHelp() const; + + k_dcop: + +private: + + KConfig *config; + bool _ok; + KPopupMenu * _popUpKardChooser; + + +}; + +#endif + diff --git a/kcontrol/iccconfig/iccconfigbase.ui b/kcontrol/iccconfig/iccconfigbase.ui new file mode 100644 index 000000000..0d6689fd7 --- /dev/null +++ b/kcontrol/iccconfig/iccconfigbase.ui @@ -0,0 +1,102 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>ICCConfigBase</class> +<widget class="QWidget"> + <property name="name"> + <cstring>ICCConfigBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>519</width> + <height>356</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QTabWidget" row="0" column="0"> + <property name="name"> + <cstring>TabWidget2</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>ICC Color Profile Configuration</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="0" column="0" colspan="2"> + <property name="name"> + <cstring>enableSupport</cstring> + </property> + <property name="text"> + <string>&Enable global ICC color profile support</string> + </property> + </widget> + <widget class="KURLRequester" row="1" column="1"> + <property name="name"> + <cstring>iccFile</cstring> + </property> + <property name="filter"> + <string>*.icc</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel2_2</cstring> + </property> + <property name="text"> + <string>ICC File</string> + </property> + </widget> + <spacer row="2" column="0"> + <property name="name" stdset="0"> + <cstring>Spacer4</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + </widget> + </grid> +</widget> +<connections> + <connection> + <sender>enableSupport</sender> + <signal>toggled(bool)</signal> + <receiver>ICCConfigBase</receiver> + <slot>enableSupport_toggled(bool)</slot> + </connection> +</connections> +<includes> + <include location="local" impldecl="in implementation">ICCConfigBase.ui.h</include> +</includes> +<slots> + <slot>enableSupport_toggled(bool)</slot> +</slots> +<includes> + <include location="local" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="3" margin="6"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/kcontrol/iccconfig/iccconfigbase2.ui b/kcontrol/iccconfig/iccconfigbase2.ui new file mode 100644 index 000000000..cad130b47 --- /dev/null +++ b/kcontrol/iccconfig/iccconfigbase2.ui @@ -0,0 +1,104 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>ICCConfigBase</class> +<widget class="QWidget"> + <property name="name"> + <cstring>ICCConfigBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>519</width> + <height>356</height> + </rect> + </property> + <property name="caption"> + <string>ICCConfigBase</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QTabWidget" row="0" column="0"> + <property name="name"> + <cstring>TabWidget2</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>ICC Color Profile Configuration</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>enableSupport</cstring> + </property> + <property name="text"> + <string>&Enable ICC color profile support</string> + </property> + </widget> + <widget class="KURLRequester" row="1" column="1"> + <property name="name"> + <cstring>editPCF</cstring> + </property> + <property name="filter"> + <string>.icc</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel2_2</cstring> + </property> + <property name="text"> + <string>ICC File</string> + </property> + </widget> + <spacer row="2" column="0"> + <property name="name"> + <cstring>Spacer4</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + </widget> + </grid> +</widget> +<connections> + <connection> + <sender>enableSupport</sender> + <signal>toggled(bool)</signal> + <receiver>ICCConfigBase</receiver> + <slot>enableSupport_toggled(bool)</slot> + </connection> +</connections> +<slots> + <slot>enableSupport_toggled(bool)</slot> +</slots> +<layoutdefaults spacing="3" margin="6"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +<includehints> + <includehint>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/kcontrol/info/cdinfo.desktop b/kcontrol/info/cdinfo.desktop index b5a441e47..17302d5b5 100644 --- a/kcontrol/info/cdinfo.desktop +++ b/kcontrol/info/cdinfo.desktop @@ -163,4 +163,4 @@ Keywords[uk]=CD-ROM Information,CD-ROM,CD,CD Drive,Writer Capabilities,Інфо� Keywords[vi]=Thông tin đĩa CD-ROM,CD-ROM,CD, ổ đĩa CD, Khả năng ổ ghi Keywords[wa]=Informåcion do CD-ROM,CD-ROM,CD,léjheu d' CD,Usteyes di scrijhaedje -Categories=Qt;KDE;X-KDE-information; +Categories=Qt;KDE;X-KDE-settings-hardware; diff --git a/kcontrol/info/devices.desktop b/kcontrol/info/devices.desktop index 171224aa6..5895b8c3a 100644 --- a/kcontrol/info/devices.desktop +++ b/kcontrol/info/devices.desktop @@ -3,7 +3,7 @@ Exec=kcmshell devices Icon=kcmdevices Type=Application DocPath=kinfocenter/devices/index.html -Categories=Qt;KDE;X-KDE-information; +Categories=Qt;KDE;X-KDE-settings-hardware; X-KDE-Library=info diff --git a/kcontrol/info/dma.desktop b/kcontrol/info/dma.desktop index e420acaea..bb02419ca 100644 --- a/kcontrol/info/dma.desktop +++ b/kcontrol/info/dma.desktop @@ -3,7 +3,7 @@ Exec=kcmshell dma Icon=kcmmemory Type=Application DocPath=kinfocenter/dma/index.html -Categories=Qt;KDE;X-KDE-information; +Categories=Qt;KDE;X-KDE-settings-hardware; X-KDE-Library=info diff --git a/kcontrol/info/interrupts.desktop b/kcontrol/info/interrupts.desktop index a18bde656..bdfb6e6e6 100644 --- a/kcontrol/info/interrupts.desktop +++ b/kcontrol/info/interrupts.desktop @@ -3,7 +3,7 @@ Exec=kcmshell interrupts Icon=kcmmemory Type=Application DocPath=kinfocenter/interrupts/index.html -Categories=Qt;KDE;X-KDE-information; +Categories=Qt;KDE;X-KDE-settings-hardware; X-KDE-Library=info diff --git a/kcontrol/info/ioports.desktop b/kcontrol/info/ioports.desktop index f66b81288..1a3505314 100644 --- a/kcontrol/info/ioports.desktop +++ b/kcontrol/info/ioports.desktop @@ -3,7 +3,7 @@ Exec=kcmshell ioports Icon=kcmmemory Type=Application DocPath=kinfocenter/ioports/index.html -Categories=Qt;KDE;X-KDE-information; +Categories=Qt;KDE;X-KDE-settings-hardware; X-KDE-Library=info diff --git a/kcontrol/info/memory.desktop b/kcontrol/info/memory.desktop index f9aca9869..e94646cfe 100644 --- a/kcontrol/info/memory.desktop +++ b/kcontrol/info/memory.desktop @@ -245,4 +245,5 @@ Keywords[xh]=Inkumbulo,RAM,Inkumbulo yobume,Inkumbulo yomzimba,Inkumbulo yokwahl Keywords[zh_CN]=Memory,RAM,Virtual memory,Physical memory,Shared memory,Swap,System Information,内存,虚拟存储,物理存储,共享内存,交换,系统信息 Keywords[zh_TW]=Memory,RAM,Virtual memory,Physical memory,Shared memory,Swap,System Information,記憶體,虛擬記憶體,實體記憶體,共享記憶體,系統資訊 Keywords[zu]=Inkumbulo,RAM,Inkumbulo yamanga,Inkumbulo siqu,Inkumbulo yokwabelana,Shintshanisa,Ulwazi Lwesistimu -Categories=Qt;KDE;X-KDE-information; +Categories=Qt;KDE;X-KDE-settings-hardware; + diff --git a/kcontrol/info/opengl.desktop b/kcontrol/info/opengl.desktop index 07d6b76ce..4451c5167 100644 --- a/kcontrol/info/opengl.desktop +++ b/kcontrol/info/opengl.desktop @@ -1,4 +1,5 @@ [Desktop Entry] +NoDisplay=true Exec=kcmshell opengl Icon=kcmopengl Type=Application @@ -144,4 +145,5 @@ Keywords[wa]=OpenGL,DRI,GLX,3D,VideoCard,cåte videyo,Hardware Acceleration,Grap Keywords[zh_CN]=OpenGL,DRI,GLX,3D,VideoCard,Hardware Acceleration,Graphics,X,X11,Xserver,X-Server,XFree86,Display,显卡,硬件加速,图形,X 服务器,显示 Keywords[zh_TW]=OpenGL,DRI,GLX,3D,VideoCard,Hardware Acceleration,Graphics,X,X11,Xserver,X-Server,XFree86,Display,顯示卡,硬體加速,圖形,顯示 -Categories=Qt;KDE;X-KDE-information; +Categories=Qt;KDE;X-KDE-settings-hardware; + diff --git a/kcontrol/info/partitions.desktop b/kcontrol/info/partitions.desktop index 89851a34e..ec9fce463 100644 --- a/kcontrol/info/partitions.desktop +++ b/kcontrol/info/partitions.desktop @@ -243,4 +243,5 @@ Keywords[zh_CN]=Partitions,Harddrive,HD,System Information,分区,硬盘,系统� Keywords[zh_TW]=Partitions,Harddrive,HD,System Information,磁碟分割區,硬式磁碟機,硬碟,系統資訊 Keywords[zu]=Izahluko,Harddrive,HD,Ulwazi Lwesistimu -Categories=Qt;KDE;X-KDE-information; +Categories=Qt;KDE;X-KDE-settings-hardware; + diff --git a/kcontrol/info/pci.desktop b/kcontrol/info/pci.desktop index 9ee4452b3..d60a876ef 100644 --- a/kcontrol/info/pci.desktop +++ b/kcontrol/info/pci.desktop @@ -177,4 +177,5 @@ Keywords[xh]=PCI,PCI-Amacebo,PCI-Ibhasi,Ulwazi lwendlela Keywords[zh_CN]=PCI,PCI-Devices,PCI-Bus,System Information,PCI 设备,PCI 总线,系统信息 Keywords[zh_TW]=PCI,PCI-Devices,PCI-Bus,System Information,PCI 設備,PCI 匯流排,系統資訊 Keywords[zu]=PCI,Amathuluzi-PCI,Ibhasi-PCI,Ulwaz Lwesistimu -Categories=Qt;KDE;X-KDE-information; +Categories=Qt;KDE;X-KDE-settings-hardware; + diff --git a/kcontrol/info/processor.desktop b/kcontrol/info/processor.desktop index 580aa7e3a..c72f50e2c 100644 --- a/kcontrol/info/processor.desktop +++ b/kcontrol/info/processor.desktop @@ -246,4 +246,5 @@ Keywords[xh]=Umqhubekekisi,CPU,FPU,MHz,Inkcukacha Yendlela yokusebenza Keywords[zh_CN]=Processor,CPU,FPU,MHz,System Information,处理器,系统信息 Keywords[zh_TW]=Processor,CPU,FPU,MHz,System Information,處理器,中央處理器,浮點運算器,系統資訊 Keywords[zu]=Umqhubekisi,CPU,FPU,MHz,Ulwazi Lwesistimu -Categories=Qt;KDE;X-KDE-information; +Categories=Qt;KDE;X-KDE-settings-hardware; + diff --git a/kcontrol/info/scsi.desktop b/kcontrol/info/scsi.desktop index 9b62edbf7..9b2aa65a8 100644 --- a/kcontrol/info/scsi.desktop +++ b/kcontrol/info/scsi.desktop @@ -174,4 +174,5 @@ Keywords[xh]=SCSI,SCSI-Ibhasi,Ulwazi lwendlela Keywords[zh_CN]=SCSI,SCSI-Bus,System Information,SCSI 总线,系统信息 Keywords[zh_TW]=SCSI,SCSI-Bus,System Information,系統資訊 Keywords[zu]=SCSI,Ibhasi-SCSI,Ulwazi Lwesistimu -Categories=Qt;KDE;X-KDE-information; +Categories=Qt;KDE;X-KDE-settings-hardware; + diff --git a/kcontrol/info/sound.desktop b/kcontrol/info/sound.desktop index 6a96da85d..4f8942871 100644 --- a/kcontrol/info/sound.desktop +++ b/kcontrol/info/sound.desktop @@ -240,4 +240,5 @@ Keywords[vi]=Âm thanh,âm,Bo mạch âm thanh,Midi,OSS,Thông tin Hệ thống Keywords[wa]=Son,Audiocåte son,MIDI,OSS,informåcion do sistinme Keywords[zh_CN]=Sound,Audio,Soundcard,MIDI,OSS,System Information,音频,音响,声卡,系统信息 Keywords[zh_TW]=Sound,Audio,Soundcard,Midi,OSS,系統資訊 -Categories=Qt;KDE;X-KDE-information; +Categories=Qt;KDE;X-KDE-settings-hardware; + diff --git a/kcontrol/info/xserver.desktop b/kcontrol/info/xserver.desktop index 1751a4b6e..e54b9e2a4 100644 --- a/kcontrol/info/xserver.desktop +++ b/kcontrol/info/xserver.desktop @@ -224,4 +224,4 @@ Keywords[wa]=X,X-Server,XServer,sierveu X,XFree86,håynaedje,Display,cåte videy Keywords[zh_CN]=X,X-Server,XServer,XFree86,Display,VideoCard,System InformationX 服务器,显示器,显卡,系统信息 Keywords[zh_TW]=X,X-Server,XServer,XFree86,Display,VideoCard,System Information,X 伺服器,X伺服器,顯示器,顯示卡,系統資訊 -Categories=Qt;KDE;X-KDE-information; +Categories=Qt;KDE;X-KDE-settings-hardware; diff --git a/kcontrol/input/consoleUserPerms b/kcontrol/input/consoleUserPerms index 015df642f..af7e267bd 100755 --- a/kcontrol/input/consoleUserPerms +++ b/kcontrol/input/consoleUserPerms @@ -1,42 +1,16 @@ -#!/bin/bash -# -# /etc/hotplug/usb/consoleUserPerms -# -# Sets up newly plugged in USB device so that the user who owns -# the console according to pam_console can access it from user space -# -# Note that for this script to work, you'll need all of the following: -# a) a line in the file /etc/hotplug/usb.usermap or another usermap file -# in /etc/hotplug/usb/ that corresponds to the device you are using. -# b) a setup using pam_console creates the respective lock files -# containing the name of the respective user. You can check for that -# by executing "echo `cat /var/{run,lock}/console.lock`" and -# verifying the appropriate user is mentioned somewhere there. -# c) a Linux kernel supporting hotplug and usbdevfs -# d) the hotplug package (http://linux-hotplug.sourceforge.net/) -# -# In the usermap file, the first field "usb module" should be named -# "consoleUserPerms" to invoke this script. -# +#!/bin/sh -if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ] +GROUP=plugdev + +if [ "${ACTION}" = "add" ] then - # New code, using lock files instead of copying /dev/console permissions - # This also works with non-kdm logins (e.g. on a virtual terminal) - # Idea and code from Nalin Dahyabhai <[email protected]> - if [ -f /var/run/console.lock ] - then - CONSOLEOWNER=`cat /var/run/console.lock` - elif [ -f /var/lock/console.lock ] - then - CONSOLEOWNER=`cat /var/lock/console.lock` - else - CONSOLEOWNER= - fi - if [ -n "$CONSOLEOWNER" ] - then - chmod 0000 "${DEVICE}" - chown "$CONSOLEOWNER" "${DEVICE}" - chmod 0600 "${DEVICE}" + if getent group $GROUP > /dev/null; then + N=0 + while [ ! -e $DEVICE ] && [ $N -lt 25 ]; do + sleep 1 + N=$(expr $N + 1) + done + chmod 660 "${DEVICE}" + chown root:$GROUP "${DEVICE}" fi fi diff --git a/kcontrol/ioslaveinfo/ioslaveinfo.desktop b/kcontrol/ioslaveinfo/ioslaveinfo.desktop index a9ece6f71..ccc39962e 100644 --- a/kcontrol/ioslaveinfo/ioslaveinfo.desktop +++ b/kcontrol/ioslaveinfo/ioslaveinfo.desktop @@ -234,4 +234,4 @@ X-KDE-Library=ioslaveinfo X-KDE-ParentApp=kinfocenter -Categories=Qt;KDE;X-KDE-information; +Categories=Qt;KDE;X-KDE-settings-network; diff --git a/kcontrol/kcontrol/KControl.desktop b/kcontrol/kcontrol/KControl.desktop index c174a867a..1640fca11 100644 --- a/kcontrol/kcontrol/KControl.desktop +++ b/kcontrol/kcontrol/KControl.desktop @@ -91,3 +91,5 @@ Name[zu]=Indawo Yokulawula X-DCOP-ServiceType=Unique Categories=Qt;KDE;Core; +OnlyShowIn=KDE; +NoDisplay=true diff --git a/kcontrol/kcontrol/kinfocenter.desktop b/kcontrol/kcontrol/kinfocenter.desktop index cd3e27f0a..56be4ec0d 100644 --- a/kcontrol/kcontrol/kinfocenter.desktop +++ b/kcontrol/kcontrol/kinfocenter.desktop @@ -107,3 +107,4 @@ GenericName[zh_TW]=資訊中心 X-DCOP-ServiceType=Unique Categories=Qt;KDE;System; +OnlyShowIn=KDE; diff --git a/kcontrol/kdm/kdm-appear.cpp b/kcontrol/kdm/kdm-appear.cpp index 684371d74..7d1d034ca 100644 --- a/kcontrol/kdm/kdm-appear.cpp +++ b/kcontrol/kdm/kdm-appear.cpp @@ -442,7 +442,7 @@ void KDMAppearanceWidget::load() config->setGroup("X-*-Greeter"); // Read the greeting string - greetstr_lined->setText(config->readEntry("GreetString", i18n("Welcome to %s at %n"))); + greetstr_lined->setText(config->readEntry("GreetString", i18n("Welcome to Kubuntu at %n"))); // Regular logo or clock QString logoArea = config->readEntry("LogoArea", "Logo" ); @@ -485,7 +485,7 @@ void KDMAppearanceWidget::load() void KDMAppearanceWidget::defaults() { - greetstr_lined->setText( i18n("Welcome to %s at %n") ); + greetstr_lined->setText( i18n("Welcome to Kubuntu at %n") ); logoRadio->setChecked( true ); slotAreaRadioClicked( KdmLogo ); setLogo( "" ); diff --git a/kcontrol/kdm/kdm-font.cpp b/kcontrol/kdm/kdm-font.cpp index da67e5eaa..456573b4d 100644 --- a/kcontrol/kdm/kdm-font.cpp +++ b/kcontrol/kdm/kdm-font.cpp @@ -92,7 +92,7 @@ void KDMFontWidget::set_def() { stdFontChooser->setFont(QFont("Sans Serif", 10)); failFontChooser->setFont(QFont("Sans Serif", 10, QFont::Bold)); - greetingFontChooser->setFont(QFont("Serif", 20)); + greetingFontChooser->setFont(QFont("Sans Serif", 22)); } void KDMFontWidget::save() @@ -128,7 +128,7 @@ void KDMFontWidget::load() void KDMFontWidget::defaults() { set_def(); - aacb->setChecked(false); + aacb->setChecked(true); } #include "kdm-font.moc" diff --git a/kcontrol/kdm/kdm-shut.cpp b/kcontrol/kdm/kdm-shut.cpp index c958e1464..2eb88ac51 100644 --- a/kcontrol/kdm/kdm-shut.cpp +++ b/kcontrol/kdm/kdm-shut.cpp @@ -200,7 +200,7 @@ void KDMSessionsWidget::load() config->setGroup("Shutdown"); restart_lined->setURL(config->readEntry("RebootCmd", "/sbin/reboot")); - shutdown_lined->setURL(config->readEntry("HaltCmd", "/sbin/halt")); + shutdown_lined->setURL(config->readEntry("HaltCmd", "/sbin/poweroff")); bm_combo->setCurrentId(config->readEntry("BootManager", "None")); } @@ -210,7 +210,7 @@ void KDMSessionsWidget::load() void KDMSessionsWidget::defaults() { restart_lined->setURL("/sbin/reboot"); - shutdown_lined->setURL("/sbin/halt"); + shutdown_lined->setURL("/sbin/poweroff"); sdlcombo->setCurrentItem(SdAll); sdrcombo->setCurrentItem(SdRoot); diff --git a/kcontrol/keys/shortcuts.cpp b/kcontrol/keys/shortcuts.cpp index e65364f4c..2ceceb46a 100644 --- a/kcontrol/keys/shortcuts.cpp +++ b/kcontrol/keys/shortcuts.cpp @@ -24,9 +24,12 @@ #include "shortcuts.h" +#include <stdlib.h> + #include <qdir.h> #include <qlayout.h> #include <qwhatsthis.h> +#include <qcheckbox.h> #include <kapplication.h> #include <kdebug.h> @@ -101,6 +104,8 @@ QString ShortcutsModule::quickHelp() const void ShortcutsModule::initGUI() { + QString kde_winkeys_env_dir = KGlobal::dirs()->localkdedir() + "/env/"; + kdDebug(125) << "A-----------" << endl; KAccelActions* keys = &m_actionsGeneral; // see also KShortcutsModule::init() below !!! @@ -172,8 +177,27 @@ void ShortcutsModule::initGUI() m_pTab->setMargin( KDialog::marginHint() ); pVLayout->addWidget( m_pTab ); + // See if ~/.kde3/env/win-key.sh exists + QFile f( kde_winkeys_env_dir + "win-key.sh" ); + if ( f.exists() == false ) { + // No, it does not, so Win is a modifier + m_bUseRmWinKeys = true; + } + else { + // Yes, it does, so Win is a key + m_bUseRmWinKeys = false; + } m_pListGeneral = new KAccelShortcutList( m_actionsGeneral, true ); + m_pkcGeneral = new KKeyChooser( m_pListGeneral, this, KKeyChooser::Global, false ); + m_pkcGeneral->resize (m_pkcGeneral->sizeHint() ); + if (system("xmodmap 1> /dev/null 2> /dev/null") == 0) { + m_useRmWinKeys = new QCheckBox( i18n("Use Win key as modifier (uncheck to bind Win key to Menu)"), this ); + m_useRmWinKeys->resize( m_useRmWinKeys->sizeHint() ); + m_useRmWinKeys->setChecked( m_bUseRmWinKeys ); + pVLayout->addWidget( m_useRmWinKeys, 1, 0 ); + connect( m_useRmWinKeys, SIGNAL(clicked()), SLOT(slotUseRmWinKeysClicked()) ); + } m_pTab->addTab( m_pkcGeneral, i18n("&Global Shortcuts") ); connect( m_pkcGeneral, SIGNAL(keyChange()), SLOT(slotKeyChange()) ); @@ -432,4 +456,37 @@ void ShortcutsModule::slotRemoveScheme() { } +void ShortcutsModule::slotUseRmWinKeysClicked() +{ + QString kde_winkeys_env_dir = KGlobal::dirs()->localkdedir() + "/env/"; + + // See if ~/.kde3/env/win-key.sh exists + QFile f( kde_winkeys_env_dir + "win-key.sh" ); + if ( f.exists() == false ) { + // No, it does not, so Win is currently a modifier + if (m_useRmWinKeys->isChecked() == false) { + // Create the file + if ( f.open( IO_WriteOnly ) ) { + QTextStream stream( &f ); + stream << "xmodmap -e 'keycode 133=Menu'" << "\n"; + stream << "xmodmap -e 'keycode 134=Menu'" << "\n"; + f.close(); + system("xmodmap -e 'keycode 133=Menu'"); + system("xmodmap -e 'keycode 134=Menu'"); + } + } + } + else { + // Yes, it does, so Win is currently a key + m_bUseRmWinKeys = false; + if (m_useRmWinKeys->isChecked() == true) { + // Remove the file + f.remove(); + // Update key mappings + system("xmodmap -e 'keycode 133=Super_L'"); + system("xmodmap -e 'keycode 134=Super_R'"); + } + } +} + #include "shortcuts.moc" diff --git a/kcontrol/keys/shortcuts.h b/kcontrol/keys/shortcuts.h index a16a619e3..e51d8cb7a 100644 --- a/kcontrol/keys/shortcuts.h +++ b/kcontrol/keys/shortcuts.h @@ -25,6 +25,7 @@ #define __SHORTCUTS_MODULE_H #include <qbuttongroup.h> +#include <qcheckbox.h> #include <qpushbutton.h> #include <qradiobutton.h> #include <qtabwidget.h> @@ -61,6 +62,7 @@ class ShortcutsModule : public QWidget void slotSelectScheme( int = 0 ); void slotSaveSchemeAs(); void slotRemoveScheme(); + void slotUseRmWinKeysClicked(); private: QTabWidget* m_pTab; @@ -72,6 +74,8 @@ class ShortcutsModule : public QWidget KAccelActions m_actionsGeneral, m_actionsSequence;//, m_actionsApplication; KShortcutList* m_pListGeneral, * m_pListSequence, * m_pListApplication; KKeyChooser* m_pkcGeneral, * m_pkcSequence, * m_pkcApplication; + QCheckBox* m_useRmWinKeys; + bool m_bUseRmWinKeys; }; #endif // __SHORTCUTS_MODULE_H diff --git a/kcontrol/kfontinst/kfontinst/Fontmap.cpp b/kcontrol/kfontinst/kfontinst/Fontmap.cpp index 0f8178dee..87cfabad8 100644 --- a/kcontrol/kfontinst/kfontinst/Fontmap.cpp +++ b/kcontrol/kfontinst/kfontinst/Fontmap.cpp @@ -65,13 +65,13 @@ static bool parseLine(const char *line, QString &ps, QString &fname, bool &isAli char a[constMaxLen+1], b[constFileMaxLen+1]; - const char *slash1=strchr(line, '/'), + char *slash1=(char*)strchr(line, '/'), *space1=slash1 ? findSpace(slash1) : NULL, //strchr(slash1, ' ') : NULL, - *ob=slash1 ? strchr(slash1, '(') : NULL, - *cb=ob ? strchr(ob, ')') : NULL, - *slash2=space1 && !ob && !cb ? strchr(space1, '/') : NULL, + *ob=slash1 ? (char*)strchr(slash1, '(') : NULL, + *cb=ob ? (char*)strchr(ob, ')') : NULL, + *slash2=space1 && !ob && !cb ? (char*)strchr(space1, '/') : NULL, *space2=slash2 ? findSpace(slash2) : NULL, // strchr(slash2, ' ') : NULL, - *semic=cb || space2 ? strchr(cb ? cb : space2, ';') : NULL; + *semic=cb || space2 ? (char*)strchr(cb ? cb : space2, ';') : NULL; if(semic && space1-slash1<constMaxLen) { diff --git a/kcontrol/kfontinst/kfontinst/XConfig.cpp b/kcontrol/kfontinst/kfontinst/XConfig.cpp index 490c8dfe5..aa63e52af 100644 --- a/kcontrol/kfontinst/kfontinst/XConfig.cpp +++ b/kcontrol/kfontinst/kfontinst/XConfig.cpp @@ -356,8 +356,8 @@ static char * getItem(char **start, char **end, const char *key, unsigned int &s if(s && *s=='\"' && s<*end) { - char *e=strchr(s+1, '\"'), - *nl=strchr(s+1, '\n'); + char *e=(char*)strchr(s+1, '\"'), + *nl=(char*)strchr(s+1, '\n'); if(e && e<*end && (!nl || nl>e) && e-s<=constMaxItemLen) { diff --git a/kcontrol/kicker/main.cpp b/kcontrol/kicker/main.cpp index 4ef0f842f..021cfbdd9 100644 --- a/kcontrol/kicker/main.cpp +++ b/kcontrol/kicker/main.cpp @@ -132,6 +132,18 @@ void KickerConfig::init() configFileWatch->startScan(); } +void KickerConfig::restartKicker() +{ + // Tell kicker to restart + if (!kapp->dcopClient()->isAttached()) + { + kapp->dcopClient()->attach(); + } + QCString appname; + appname = "kicker"; + kapp->dcopClient()->send(appname, appname, "restart", ""); +} + void KickerConfig::notifyKicker() { kdDebug() << "KickerConfig::notifyKicker()" << endl; diff --git a/kcontrol/kicker/main.h b/kcontrol/kicker/main.h index cb585b077..1797f7637 100644 --- a/kcontrol/kicker/main.h +++ b/kcontrol/kicker/main.h @@ -43,6 +43,7 @@ public: QString configName(); void notifyKicker(); + void restartKicker(); QString quickHelp() const; KAboutData *aboutData(); diff --git a/kcontrol/kicker/menutab.ui b/kcontrol/kicker/menutab.ui index 8d49a7965..e64285767 100644 --- a/kcontrol/kicker/menutab.ui +++ b/kcontrol/kicker/menutab.ui @@ -143,6 +143,155 @@ </size> </property> </spacer> + <widget class="QCheckBox" row="0" column="0" colspan="2"> + <property name="name"> + <cstring>kcfg_ShowKMenuText</cstring> + </property> + <property name="text"> + <string>Display text in K Menu button</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string><qt>When this option is selected the text below will be shown in the K Menu button.</string> + </property> + </widget> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QLineEdit" row="0" column="1" colspan="3"> + <property name="name"> + <cstring>kcfg_KMenuText</cstring> + </property> + <property name="maxLength"> + <number>35</number> + </property> + </widget> + <widget class="QLabel" row="3" column="0" colspan="2"> + <property name="name"> + <cstring>TextLabel1_3_3_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>4</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Custom K Menu button icon:</string> + </property> + </widget> + <widget class="KPushButton" row="3" column="3" colspan="2"> + <property name="name"> + <cstring>btnCustomKMenuIcon</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>26</width> + <height>26</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>26</width> + <height>26</height> + </size> + </property> + <property name="acceptDrops"> + <bool>false</bool> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>TextLabel1_3_3_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>4</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Text:</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>TextLabel1_3_3_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>4</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Font:</string> + </property> + </widget> + <widget class="KFontRequester" row="2" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>kcfg_ButtonFont</cstring> + </property> + </widget> + <spacer row="3" column="3"> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + <spacer> + <property name="name"> + <cstring>spacer8</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>MinimumExpanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> <property name="name"> <cstring>m_editKMenuButton</cstring> @@ -194,187 +343,266 @@ </widget> </hbox> </widget> - <widget class="QGroupBox"> - <property name="name"> - <cstring>m_browserGroup</cstring> - </property> - <property name="title"> - <string>QuickBrowser Menus</string> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLayoutWidget" row="1" column="0"> - <property name="name"> - <cstring>Layout3</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>m_maxQuickBrowserItemsLabel</cstring> - </property> - <property name="text"> - <string>Ma&ximum number of entries:</string> - </property> - <property name="buddy" stdset="0"> - <cstring>kcfg_MaxEntries2</cstring> - </property> - <property name="whatsThis" stdset="0"> - <string>When browsing directories that contain a lot of files, the QuickBrowser can sometimes hide your whole desktop. Here you can limit the number of entries shown at a time in the QuickBrowser. This is particularly useful for low screen resolutions.</string> - </property> - </widget> - <widget class="KIntNumInput"> - <property name="name"> - <cstring>kcfg_MaxEntries2</cstring> - </property> - <property name="value"> - <number>30</number> - </property> - <property name="minValue"> - <number>10</number> - </property> - <property name="maxValue"> - <number>100</number> - </property> - <property name="whatsThis" stdset="0"> - <string>When browsing directories that contain a lot of files, the QuickBrowser can sometimes hide your whole desktop. Here you can limit the number of entries shown at a time in the QuickBrowser. This is particularly useful for low screen resolutions.</string> - </property> - </widget> - </hbox> - </widget> - <widget class="QCheckBox" row="0" column="0"> - <property name="name"> - <cstring>kcfg_ShowHiddenFiles</cstring> - </property> - <property name="text"> - <string>Show hidden fi&les</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - <property name="whatsThis" stdset="0"> - <string>If this option is enabled, hidden files (i.e. files beginning with a dot) will be shown in the QuickBrowser menus.</string> - </property> - </widget> - <spacer row="0" column="1" rowspan="2" colspan="1"> - <property name="name"> - <cstring>Spacer7</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </grid> - </widget> - <widget class="QButtonGroup"> - <property name="name"> - <cstring>m_pRecentOrderGroup</cstring> - </property> - <property name="title"> - <string>QuickStart Menu Items</string> - </property> - <grid> - <property name="name"> - <cstring>unnamed</cstring> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> </property> - <widget class="QLayoutWidget" row="2" column="0"> - <property name="name"> - <cstring>Layout4</cstring> - </property> - <hbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QLabel"> - <property name="name"> - <cstring>TextLabel2</cstring> - </property> - <property name="text"> - <string>Maxim&um number of entries:</string> - </property> - <property name="buddy" stdset="0"> - <cstring>kcfg_NumVisibleEntries</cstring> - </property> - <property name="whatsThis" stdset="0"> - <string>This option allows you to define the maximum number of applications that should be displayed in the QuickStart menu area.</string> - </property> - </widget> - <widget class="KIntNumInput"> - <property name="name"> - <cstring>kcfg_NumVisibleEntries</cstring> - </property> - <property name="value"> - <number>5</number> - </property> - <property name="minValue"> - <number>0</number> - </property> - <property name="maxValue"> - <number>20</number> - </property> - <property name="whatsThis" stdset="0"> - <string>This option allows you to define how many applications should be displayed at most in the QuickStart menu area.</string> - </property> - </widget> - </hbox> - </widget> - <widget class="QRadioButton" row="0" column="0"> - <property name="name"> - <cstring>kcfg_RecentVsOften</cstring> - </property> - <property name="text"> - <string>Show the &applications most recently used</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - <property name="whatsThis" stdset="0"> - <string>When this option is selected the QuickStart menu area will be filled with the applications you have used most recently.</string> - </property> - </widget> - <widget class="QRadioButton" row="1" column="0"> - <property name="name"> - <cstring>m_showFrequent</cstring> - </property> - <property name="text"> - <string>Show the applications most fre&quently used</string> - </property> - <property name="whatsThis" stdset="0"> - <string>When this option is selected the QuickStart menu area will be filled with the applications you use most frequently.</string> - </property> - </widget> - <spacer row="0" column="1" rowspan="3" colspan="1"> - <property name="name"> - <cstring>Spacer8</cstring> - </property> - <property name="orientation"> - <enum>Horizontal</enum> - </property> - <property name="sizeType"> - <enum>Expanding</enum> - </property> - <property name="sizeHint"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </grid> - </widget> + <widget class="QGroupBox" row="0" column="0"> + <property name="name"> + <cstring>m_browserGroup</cstring> + </property> + <property name="title"> + <string>QuickBrowser Menus</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="1" column="0"> + <property name="name"> + <cstring>Layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>m_maxQuickBrowserItemsLabel</cstring> + </property> + <property name="text"> + <string>Ma&ximum number of entries:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kcfg_MaxEntries2</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>When browsing directories that contain a lot of files, the QuickBrowser can sometimes hide your whole desktop. Here you can limit the number of entries shown at a time in the QuickBrowser. This is particularly useful for low screen resolutions.</string> + </property> + </widget> + <widget class="KIntNumInput"> + <property name="name"> + <cstring>kcfg_MaxEntries2</cstring> + </property> + <property name="value"> + <number>30</number> + </property> + <property name="minValue"> + <number>10</number> + </property> + <property name="maxValue"> + <number>100</number> + </property> + <property name="whatsThis" stdset="0"> + <string>When browsing directories that contain a lot of files, the QuickBrowser can sometimes hide your whole desktop. Here you can limit the number of entries shown at a time in the QuickBrowser. This is particularly useful for low screen resolutions.</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>kcfg_ShowHiddenFiles</cstring> + </property> + <property name="text"> + <string>Show hidden fi&les</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string>If this option is enabled, hidden files (i.e. files beginning with a dot) will be shown in the QuickBrowser menus.</string> + </property> + </widget> + <spacer row="0" column="1" rowspan="2" colspan="1"> + <property name="name"> + <cstring>Spacer7</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </grid> + </widget> + <widget class="QGroupBox" row="1" column="0"> + <property name="name"> + <cstring>m_recentGroup</cstring> + </property> + <property name="title"> + <string>Recent Documents Menu</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="1" column="0"> + <property name="name"> + <cstring>Layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>m_maxRecentDocumentsItemsLabel</cstring> + </property> + <property name="text"> + <string>Ma&ximum number of entries:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kcfg_MaxEntries2</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>This sets the maximum number of recently accessed documents stored for fast retrieval.</string> + </property> + </widget> + <widget class="KIntNumInput"> + <property name="name"> + <cstring>maxrecentdocs</cstring> + </property> + <property name="value"> + <number>10</number> + </property> + <property name="minValue"> + <number>10</number> + </property> + <property name="maxValue"> + <number>100</number> + </property> + <property name="whatsThis" stdset="0"> + <string>This sets the maximum number of recently accessed documents stored for fast retrieval.</string> + </property> + </widget> + </hbox> + </widget> + <spacer row="0" column="1" rowspan="2" colspan="1"> + <property name="name"> + <cstring>Spacer7</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </grid> + </widget> + <widget class="QButtonGroup" row="0" column="1" rowspan="2"> + <property name="name"> + <cstring>m_pRecentOrderGroup</cstring> + </property> + <property name="title"> + <string>QuickStart Menu Items</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="2" column="0"> + <property name="name"> + <cstring>Layout4</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="text"> + <string>Maxim&um number of entries:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>kcfg_NumVisibleEntries</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>This option allows you to define the maximum number of applications that should be displayed in the QuickStart menu area.</string> + </property> + </widget> + <widget class="KIntNumInput"> + <property name="name"> + <cstring>kcfg_NumVisibleEntries</cstring> + </property> + <property name="value"> + <number>5</number> + </property> + <property name="minValue"> + <number>0</number> + </property> + <property name="maxValue"> + <number>20</number> + </property> + <property name="whatsThis" stdset="0"> + <string>This option allows you to define how many applications should be displayed at most in the QuickStart menu area.</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QRadioButton" row="0" column="0"> + <property name="name"> + <cstring>kcfg_RecentVsOften</cstring> + </property> + <property name="text"> + <string>Show the &applications most recently used</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string>When this option is selected the QuickStart menu area will be filled with the applications you have used most recently.</string> + </property> + </widget> + <widget class="QRadioButton" row="1" column="0"> + <property name="name"> + <cstring>m_showFrequent</cstring> + </property> + <property name="text"> + <string>Show the applications most fre&quently used</string> + </property> + <property name="whatsThis" stdset="0"> + <string>When this option is selected the QuickStart menu area will be filled with the applications you use most frequently.</string> + </property> + </widget> + <spacer row="0" column="1" rowspan="3" colspan="1"> + <property name="name"> + <cstring>Spacer8</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </grid> + </widget> + </grid> </vbox> </widget> <tabstops> diff --git a/kcontrol/kicker/menutab_impl.cpp b/kcontrol/kicker/menutab_impl.cpp index 55cabaa88..935f04684 100644 --- a/kcontrol/kicker/menutab_impl.cpp +++ b/kcontrol/kicker/menutab_impl.cpp @@ -32,8 +32,13 @@ #include <knuminput.h> #include <kstandarddirs.h> +#include <kicondialog.h> +#include <kiconloader.h> + #include "main.h" +#include "kickerSettings.h" + #include "menutab_impl.h" #include "menutab_impl.moc" @@ -66,6 +71,25 @@ MenuTab::MenuTab( QWidget *parent, const char* name ) { // connections connect(m_editKMenuButton, SIGNAL(clicked()), SLOT(launchMenuEditor())); + connect(btnCustomKMenuIcon, SIGNAL(clicked()), SLOT(launchIconEditor())); + connect(kcfg_KMenuText, SIGNAL(textChanged(QString)), SLOT(kmenuChanged())); + connect(kcfg_ShowKMenuText, SIGNAL(toggled(bool)), SLOT(kmenuChanged())); + //connect(kcfg_ButtonFont, SIGNAL(fontSelected(const QFont &)), SLOT(kmenuChanged())); + connect(maxrecentdocs, SIGNAL(valueChanged(int)), this, SLOT(changed())); + + KIconLoader * ldr = KGlobal::iconLoader(); + QPixmap kmenu_icon; + m_kmenu_icon = KickerSettings::customKMenuIcon(); + if (m_kmenu_icon.isNull() == true) { + m_kmenu_icon = QString("kmenu"); + } + kmenu_icon = ldr->loadIcon(m_kmenu_icon, KIcon::Small, KIcon::SizeSmall); + btnCustomKMenuIcon->setPixmap(kmenu_icon); + + KConfig *config; + config = new KConfig(QString::fromLatin1("kdeglobals"), false, false); + config->setGroup(QString::fromLatin1("RecentDocuments")); + maxrecentdocs->setValue(config->readNumEntry(QString::fromLatin1("MaxEntries"), 10)); m_browserGroupLayout->setColStretch( 1, 1 ); m_pRecentOrderGroupLayout->setColStretch( 1, 1 ); @@ -156,6 +180,22 @@ void MenuTab::save() c->writeEntry("Extensions", ext); c->sync(); + + // Save KMenu settings + c->setGroup("KMenu"); + c->writeEntry("CustomIcon", m_kmenu_icon); + c->sync(); + + // Save recent documents + KConfig *config; + config = new KConfig(QString::fromLatin1("kdeglobals"), false, false); + config->setGroup(QString::fromLatin1("RecentDocuments")); + config->writeEntry("MaxEntries", maxrecentdocs->value()); + config->sync(); + + if (m_kmenu_button_changed == true) { + system("dcop kicker kicker restart &"); + } } void MenuTab::defaults() @@ -179,3 +219,25 @@ void MenuTab::launchMenuEditor() i18n("Application Missing")); } } + +void MenuTab::launchIconEditor() +{ + KIconDialog dlg(this); + QString newIcon = dlg.selectIcon(KIcon::Small, KIcon::Application); + if (newIcon.isEmpty()) + return; + + m_kmenu_icon = newIcon; + KIconLoader * ldr = KGlobal::iconLoader(); + QPixmap kmenu_icon; + kmenu_icon = ldr->loadIcon(m_kmenu_icon, KIcon::Small, KIcon::SizeSmall); + btnCustomKMenuIcon->setPixmap(kmenu_icon); + m_kmenu_button_changed = true; + + emit changed(); +} + +void MenuTab::kmenuChanged() +{ + m_kmenu_button_changed = true; +} diff --git a/kcontrol/kicker/menutab_impl.h b/kcontrol/kicker/menutab_impl.h index 20ed393e1..71c669048 100644 --- a/kcontrol/kicker/menutab_impl.h +++ b/kcontrol/kicker/menutab_impl.h @@ -62,10 +62,14 @@ signals: public slots: void launchMenuEditor(); + void launchIconEditor(); + void kmenuChanged(); protected: kSubMenuItem *m_bookmarkMenu; kSubMenuItem *m_quickBrowserMenu; + QString m_kmenu_icon; + bool m_kmenu_button_changed; }; #endif diff --git a/kcontrol/kio/uasproviders/safari20.desktop b/kcontrol/kio/uasproviders/safari20.desktop index 14f3a8883..d86fe1977 100644 --- a/kcontrol/kio/uasproviders/safari20.desktop +++ b/kcontrol/kio/uasproviders/safari20.desktop @@ -51,7 +51,7 @@ Name[zh_TW]=使用者代理描述 (Safari 2.0 on MacOS X) Type=Service ServiceTypes=UserAgentStrings X-KDE-UA-TAG=SAF -X-KDE-UA-FULL=Mozilla/5.0 (Macintosh; U; PPC Mac OS X; appLanguage) AppleWebKit/412 (KHTML, like Gecko) Safari/412 +X-KDE-UA-FULL=Mozilla/5.0 (Macintosh; U; PPC Mac OS X; appLanguage) AppleWebKit/418.8 (KHTML, like Gecko) Safari/419.3 X-KDE-UA-NAME=Safari X-KDE-UA-VERSION=2.0 X-KDE-UA-SYSNAME=Mac OS diff --git a/kcontrol/konq/rootopts.cpp b/kcontrol/konq/rootopts.cpp index c546aa3ee..1a14c68e3 100644 --- a/kcontrol/konq/rootopts.cpp +++ b/kcontrol/konq/rootopts.cpp @@ -129,14 +129,16 @@ void DesktopPathConfig::load( bool useDefaults ) { KConfig config("kdeglobals", true, false); // Desktop Paths - config.setReadDefaults( useDefaults ); - - config.setGroup("Paths"); - urDesktop->setURL( config.readPathEntry( "Desktop" , KGlobalSettings::desktopPath() )); + config.setReadDefaults( useDefaults ); + config.setGroup("Paths"); urAutostart->setURL( config.readPathEntry( "Autostart" , KGlobalSettings::autostartPath() )); - urDocument->setURL( config.readPathEntry( "Documents", KGlobalSettings::documentPath() )); - emit changed( useDefaults ); + KConfig xdguserconfig( QDir::homeDirPath()+"/.config/user-dirs.dirs" ); + + urDesktop->setURL( xdguserconfig.readPathEntry( "XDG_DESKTOP_DIR" , QDir::homeDirPath() + "/Desktop" ).remove( "\"" )); + urDocument->setURL( xdguserconfig.readPathEntry( "XDG_DOCUMENTS_DIR", QDir::homeDirPath()).remove( "\"" )); + + emit changed( useDefaults ); } void DesktopPathConfig::defaults() @@ -147,6 +149,7 @@ void DesktopPathConfig::defaults() void DesktopPathConfig::save() { KConfig *config = KGlobal::config(); + KConfig *xdgconfig = new KConfig( QDir::homeDirPath()+"/.config/user-dirs.dirs" ); KConfigGroupSaver cgs( config, "Paths" ); bool pathChanged = false; @@ -205,8 +208,7 @@ void DesktopPathConfig::save() if ( moveDir( KURL( KGlobalSettings::desktopPath() ), KURL( urlDesktop ), i18n("Desktop") ) ) { -// config->writeEntry( "Desktop", urDesktop->url()); - config->writePathEntry( "Desktop", urlDesktop, true, true ); + xdgconfig->writePathEntry( "XDG_DESKTOP_DIR", '"'+ urlDesktop + '"', true, false ); pathChanged = true; } } @@ -217,7 +219,6 @@ void DesktopPathConfig::save() autostartMoved = moveDir( KURL( KGlobalSettings::autostartPath() ), KURL( urAutostart->url() ), i18n("Autostart") ); if (autostartMoved) { -// config->writeEntry( "Autostart", Autostart->url()); config->writePathEntry( "Autostart", urAutostart->url(), true, true ); pathChanged = true; } @@ -239,12 +240,13 @@ void DesktopPathConfig::save() if (pathOk) { - config->writePathEntry( "Documents", path, true, true ); + xdgconfig->writePathEntry( "XDG_DOCUMENTS_DIR", '"' + path + '"', true, false ); pathChanged = true; } } config->sync(); + xdgconfig->sync(); if (pathChanged) { diff --git a/kcontrol/konqhtml/pluginopts.cpp b/kcontrol/konqhtml/pluginopts.cpp index 7fec6f9d3..f31af3c40 100644 --- a/kcontrol/konqhtml/pluginopts.cpp +++ b/kcontrol/konqhtml/pluginopts.cpp @@ -376,6 +376,8 @@ void KPluginOptions::dirLoad( KConfig *config, bool useDefault ) else {//keep sync with kdebase/nsplugins 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/kcontrol/krdb/krdb.cpp b/kcontrol/krdb/krdb.cpp index 690dbce9a..cd8f08905 100644 --- a/kcontrol/krdb/krdb.cpp +++ b/kcontrol/krdb/krdb.cpp @@ -524,7 +524,7 @@ void runRdb( uint flags ) if (kglobals.hasKey("XftHintStyle")) { - QString hintStyle = kglobals.readEntry("XftHintStyle", "hintmedium"); + QString hintStyle = kglobals.readEntry("XftHintStyle", "hintfull"); contents += "Xft.hinting: "; if(hintStyle.isEmpty()) contents += "-1\n"; @@ -540,7 +540,7 @@ void runRdb( uint flags ) if (kglobals.hasKey("XftSubPixel")) { - QString subPixel = kglobals.readEntry("XftSubPixel"); + QString subPixel = kglobals.readEntry("XftSubPixel", "none"); if(!subPixel.isEmpty()) contents += "Xft.rgba: " + subPixel + '\n'; } diff --git a/kcontrol/krdb/themes/Plastik/Plastik.xml b/kcontrol/krdb/themes/Plastik/Plastik.xml index 4e317ed59..53b115550 100644 --- a/kcontrol/krdb/themes/Plastik/Plastik.xml +++ b/kcontrol/krdb/themes/Plastik/Plastik.xml @@ -113,12 +113,12 @@ </panel> <widgets name="Plastik" /> <fonts> - <font value="Arial,12,-1,5,50,0,0,0,0,0" object="General" /> - <fixed value="Courier New,10,-1,5,50,0,0,0,0,0" object="General" /> - <toolBarFont value="Arial,12,-1,5,50,0,0,0,0,0" object="General" /> - <menuFont value="Arial,12,-1,5,50,0,0,0,0,0" object="General" /> - <activeFont value="Arial,12,-1,5,75,0,0,0,0,0" object="WM" /> - <taskbarFont value="Arial,11,-1,5,50,0,0,0,0,0" object="General" /> + <font value="Sans Serif,10,-1,5,50,0,0,0,0,0" object="General" /> + <fixed value="Monospace,10,-1,5,50,0,0,0,0,0" object="General" /> + <toolBarFont value="Sans Serif,10,-1,5,50,0,0,0,0,0" object="General" /> + <menuFont value="Sans Serif,10,-1,5,50,0,0,0,0,0" object="General" /> + <activeFont value="Sans Serif,10,-1,5,75,0,0,0,0,0" object="WM" /> + <taskbarFont value="Sans Serif,10,-1,5,50,0,0,0,0,0" object="General" /> <StandardFont value="" object="FMSettings" /> </fonts> </ktheme> diff --git a/kcontrol/locale/Makefile.am b/kcontrol/locale/Makefile.am index 8ca082408..6872f1436 100644 --- a/kcontrol/locale/Makefile.am +++ b/kcontrol/locale/Makefile.am @@ -26,7 +26,7 @@ timezones: messages: $(XGETTEXT) -ktranslate $(kcm_locale_la_SOURCES) -o $(podir)/kcmlocale.pot - $(XGETTEXT) TIMEZONES -o $(podir)/../kdelibs/timezones.pot + $(XGETTEXT) TIMEZONES -o $(podir)/timezones.pot xdg_apps_DATA = language.desktop diff --git a/kcontrol/locale/kcmlocale.cpp b/kcontrol/locale/kcmlocale.cpp index 5d746212e..0a24b4a59 100644 --- a/kcontrol/locale/kcmlocale.cpp +++ b/kcontrol/locale/kcmlocale.cpp @@ -47,7 +47,7 @@ KLocaleConfig::KLocaleConfig(KLocale *locale, : QWidget (parent, name), m_locale(locale) { - QGridLayout *lay = new QGridLayout(this, 3, 3, + QGridLayout *lay = new QGridLayout(this, 4, 3, KDialog::marginHint(), KDialog::spacingHint()); @@ -99,6 +99,65 @@ KLocaleConfig::KLocaleConfig(KLocale *locale, lay->setColStretch(1, 1); lay->setColStretch(2, 1); + + // Added jriddell 2007-01-08, for Kubuntu Language Selector spec + QHBoxLayout* languageSelectorLayout = new QHBoxLayout(); + installLanguage = new QPushButton(i18n("Install New Language"), this); + languageSelectorLayout->addWidget(installLanguage); + uninstallLanguage = new QPushButton(i18n("Uninstall Language"), this); + languageSelectorLayout->addWidget(uninstallLanguage); + selectLanguage = new QPushButton(i18n("Select System Language"), this); + languageSelectorLayout->addWidget(selectLanguage); + languageSelectorLayout->addStretch(); + lay->addMultiCellLayout(languageSelectorLayout, 3, 3, 0, 2); + + connect( installLanguage, SIGNAL(clicked()), this, SLOT(slotInstallLanguage()) ); + connect( uninstallLanguage, SIGNAL(clicked()), this, SLOT(slotUninstallLanguage()) ); + connect( selectLanguage, SIGNAL(clicked()), this, SLOT(slotSelectLanguage()) ); + +} + +void KLocaleConfig::slotInstallLanguage() +{ + KProcess *proc = new KProcess; + + *proc << "kdesu"; + *proc << "qt-language-selector --mode install"; + QApplication::connect(proc, SIGNAL(processExited(KProcess *)), + this, SLOT(slotLanguageSelectorExited(KProcess *))); + setEnabled(false); + proc->start(); +} + +void KLocaleConfig::slotUninstallLanguage() +{ + KProcess *proc = new KProcess; + + *proc << "kdesu"; + *proc << "qt-language-selector --mode uninstall"; + QApplication::connect(proc, SIGNAL(processExited(KProcess *)), + this, SLOT(slotLanguageSelectorExited(KProcess *))); + setEnabled(false); + proc->start(); +} + +void KLocaleConfig::slotSelectLanguage() +{ + KProcess *proc = new KProcess; + + *proc << "kdesu"; + *proc << "qt-language-selector --mode select"; + QApplication::connect(proc, SIGNAL(processExited(KProcess *)), + this, SLOT(slotLanguageSelectorExited(KProcess *))); + setEnabled(false); + proc->start(); +} + +void KLocaleConfig::slotLanguageSelectorExited(KProcess *) +{ + //reload here + loadLanguageList(); + setEnabled(true); } void KLocaleConfig::slotAddLanguage(const QString & code) diff --git a/kcontrol/locale/kcmlocale.h b/kcontrol/locale/kcmlocale.h index f71193418..46f954730 100644 --- a/kcontrol/locale/kcmlocale.h +++ b/kcontrol/locale/kcmlocale.h @@ -75,6 +75,11 @@ private slots: void slotLanguageDown(); void slotCheckButtons(); + void slotInstallLanguage(); + void slotUninstallLanguage(); + void slotSelectLanguage(); + void slotLanguageSelectorExited(KProcess *); + private: QStringList languageList() const; @@ -90,6 +95,10 @@ private: QPushButton * m_removeLanguage; QPushButton * m_upButton; QPushButton * m_downButton; + + QPushButton* installLanguage; + QPushButton* uninstallLanguage; + QPushButton* selectLanguage; }; #endif diff --git a/kcontrol/nics/nic.desktop b/kcontrol/nics/nic.desktop index cddf242f6..b2ad111eb 100644 --- a/kcontrol/nics/nic.desktop +++ b/kcontrol/nics/nic.desktop @@ -170,4 +170,5 @@ Comment[zh_CN]=网络接口信息 Comment[zh_TW]=網路界面資訊 Comment[zu]=Ulwazi lomxhumanisi woxhumano olusakazekile -Categories=Qt;KDE;X-KDE-information; +Categories=Qt;KDE;X-KDE-settings-network; + diff --git a/kcontrol/randr/Makefile.am b/kcontrol/randr/Makefile.am index 6707a380d..b0ca50920 100644 --- a/kcontrol/randr/Makefile.am +++ b/kcontrol/randr/Makefile.am @@ -13,7 +13,7 @@ kcm_randr_la_LDFLAGS = -module -avoid-version $(all_libraries) -no-undefined kcm_randr_la_LIBADD = librandrinternal.la $(LIB_KDEUI) $(LIB_XRANDR) noinst_HEADERS = randr.h krandrmodule.h krandrtray.h krandrapp.h ktimerdialog.h \ - krandrpassivepopup.h + krandrpassivepopup.h lowlevel_randr.h configdialog.h xdg_apps_DATA = krandrtray.desktop @@ -28,7 +28,7 @@ krandr_datadir = $(kde_appsdir)/.hidden bin_PROGRAMS = krandrtray -krandrtray_SOURCES = main.cpp krandrtray.cpp krandrapp.cpp krandrpassivepopup.cpp +krandrtray_SOURCES = main.cpp krandrtray.cpp krandrapp.cpp krandrpassivepopup.cpp configdialog.cpp lowlevel_randr.c krandrtray_LDFLAGS = $(all_libraries) $(KDE_RPATH) krandrtray_LDADD = librandrinternal.la $(LIB_KFILE) $(LIB_KUTILS) $(LIB_XRANDR) diff --git a/kcontrol/randr/configdialog.cpp b/kcontrol/randr/configdialog.cpp new file mode 100644 index 000000000..681610c66 --- /dev/null +++ b/kcontrol/randr/configdialog.cpp @@ -0,0 +1,87 @@ +// -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*- +/* This file is part of the KDE project + Copyright (C) 2000 by Carsten Pfeiffer <[email protected]> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#include <qlabel.h> +#include <qlayout.h> +#include <qlistview.h> +#include <qpushbutton.h> +#include <qtooltip.h> +#include <qwhatsthis.h> +#include <qvbuttongroup.h> +#include <assert.h> + +#include <kiconloader.h> +#include <klocale.h> +#include <kpopupmenu.h> +#include <kwinmodule.h> +#include <kregexpeditorinterface.h> +#include <kparts/componentfactory.h> + +#include "configdialog.h" + +ConfigDialog::ConfigDialog(KGlobalAccel *accel, + bool isApplet ) + : KDialogBase( Tabbed, i18n("Configure"), + Ok | Cancel | Help, + Ok, 0L, "config dialog" ) +{ + if ( isApplet ) + setHelp( QString::null, "krandrtray" ); + + QFrame *w = 0L; // the parent for the widgets + + w = addVBoxPage( i18n("Global &Shortcuts") ); + keysWidget = new KKeyChooser( accel, w ); +} + + +ConfigDialog::~ConfigDialog() +{ +} + +// prevent huge size due to long regexps in the action-widget +void ConfigDialog::show() +{ + if ( !isVisible() ) { + KWinModule module(0, KWinModule::INFO_DESKTOP); + QSize s1 = sizeHint(); + QSize s2 = module.workArea().size(); + int w = s1.width(); + int h = s1.height(); + + if ( s1.width() >= s2.width() ) + w = s2.width(); + if ( s1.height() >= s2.height() ) + h = s2.height(); + + resize( w, h ); + } + + KDialogBase::show(); +} + +void ConfigDialog::commitShortcuts() +{ + keysWidget->commitChanges(); +} + +///////////////////////////////////////// +//// + +#include "configdialog.moc" diff --git a/kcontrol/randr/configdialog.h b/kcontrol/randr/configdialog.h new file mode 100644 index 000000000..c307a8aaa --- /dev/null +++ b/kcontrol/randr/configdialog.h @@ -0,0 +1,88 @@ +// -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*- +/* This file is part of the KDE project + Copyright (C) 2000 by Carsten Pfeiffer <[email protected]> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef CONFIGDIALOG_H +#define CONFIGDIALOG_H + +#include <qcheckbox.h> +#include <qevent.h> +#include <qgroupbox.h> +#include <qheader.h> +#include <qradiobutton.h> +#include <qvbox.h> + +#include <kdialogbase.h> +#include <keditlistbox.h> +#include <kkeydialog.h> +#include <klistview.h> +#include <knuminput.h> + +class KGlobalAccel; +class KKeyChooser; +class KListView; +class QPushButton; +class QDialog; +class ConfigDialog; + +class ConfigDialog : public KDialogBase +{ + Q_OBJECT + +public: + ConfigDialog(KGlobalAccel *accel, bool isApplet ); + ~ConfigDialog(); + + virtual void show(); + void commitShortcuts(); + +private: + KKeyChooser *keysWidget; + +}; + +class ListView : public KListView +{ +public: + ListView( ConfigDialog* configWidget, QWidget *parent, const char *name ) + : KListView( parent, name ), _configWidget( configWidget ), + _regExpEditor(0L) {} + // QListView has a weird idea of a sizeHint... + virtual QSize sizeHint () const { + int w = minimumSizeHint().width(); + int h = header()->height(); + h += viewport()->sizeHint().height(); + h += horizontalScrollBar()->height(); + + QListViewItem *item = firstChild(); + while ( item ) { + h += item->totalHeight(); + item = item->nextSibling(); + } + + return QSize( w, h ); + } + +protected: + virtual void rename( QListViewItem* item, int c ); +private: + ConfigDialog* _configWidget; + QDialog* _regExpEditor; +}; + +#endif // CONFIGDIALOG_H diff --git a/kcontrol/randr/krandrbindings.cpp b/kcontrol/randr/krandrbindings.cpp new file mode 100644 index 000000000..bb694a9bd --- /dev/null +++ b/kcontrol/randr/krandrbindings.cpp @@ -0,0 +1,34 @@ +// -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*- +/* This file is part of the KDE project + Copyright (C) by Andrew Stanley-Jones + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef NOSLOTS +# define DEF( name, key3, key4, fnSlot ) \ + keys->insert( name, i18n(name), QString::null, key3, key4, this, SLOT(fnSlot) ) +#else +# define DEF( name, key3, key4, fnSlot ) \ + keys->insert( name, i18n(name), QString::null, key3, key4 ) +#endif +#define WIN KKey::QtWIN + + keys->insert( "Program:krandrtray", i18n("Display Control") ); + + DEF( I18N_NOOP("Switch Displays"), KShortcut::KShortcut(QString("XF86Display")), KShortcut::KShortcut(QString("XF86Display")), slotCycleDisplays() ); + +#undef DEF +#undef WIN diff --git a/kcontrol/randr/krandrtray.cpp b/kcontrol/randr/krandrtray.cpp index 8e80c7cc6..20e617d75 100644 --- a/kcontrol/randr/krandrtray.cpp +++ b/kcontrol/randr/krandrtray.cpp @@ -29,11 +29,21 @@ #include <kpopupmenu.h> #include <kstdaction.h> #include <kstdguiitem.h> +#include <kglobal.h> +#include <kmessagebox.h> + +#include "configdialog.h" #include "krandrtray.h" #include "krandrpassivepopup.h" #include "krandrtray.moc" +#define OUTPUT_CONNECTED (1 << 0) +#define OUTPUT_UNKNOWN (1 << 1) +#define OUTPUT_DISCONNECTED (1 << 2) +#define OUTPUT_ON (1 << 3) +#define OUTPUT_ALL (0xf) + KRandRSystemTray::KRandRSystemTray(QWidget* parent, const char *name) : KSystemTray(parent, name) , m_popupUp(false) @@ -43,6 +53,20 @@ KRandRSystemTray::KRandRSystemTray(QWidget* parent, const char *name) setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); connect(this, SIGNAL(quitSelected()), kapp, SLOT(quit())); QToolTip::add(this, i18n("Screen resize & rotate")); + my_parent = parent; + + printf("Reading configuration...\n\r"); + globalKeys = new KGlobalAccel(this); + KGlobalAccel* keys = globalKeys; +#include "krandrbindings.cpp" + // the keys need to be read from kdeglobals, not kickerrc + globalKeys->readSettings(); + globalKeys->setEnabled(true); + globalKeys->updateConnections(); + + connect(kapp, SIGNAL(settingsChanged(int)), SLOT(slotSettingsChanged(int))); + + randr_display = XOpenDisplay(NULL); } void KRandRSystemTray::mousePressEvent(QMouseEvent* e) @@ -60,7 +84,51 @@ void KRandRSystemTray::mousePressEvent(QMouseEvent* e) void KRandRSystemTray::contextMenuAboutToShow(KPopupMenu* menu) { + //int lastIndex = 0; + + // Reload the randr configuration... + XRROutputInfo *output_info; + char *output_name; + RROutput output_id; + int i; int lastIndex = 0; + int screenDeactivated = 0; + + if (isValid() == true) { + randr_screen_info = read_screen_info(randr_display); + + for (i = 0; i < randr_screen_info->n_output; i++) { + output_info = randr_screen_info->outputs[i]->info; + // Look for ON outputs + if (!randr_screen_info->outputs[i]->cur_crtc) { + continue; + } + if (RR_Disconnected != randr_screen_info->outputs[i]->info->connection) { + continue; + } + + output_name = output_info->name; + output_id = randr_screen_info->outputs[i]->id; + + // Deactivate this display to avoid a crash! + randr_screen_info->cur_crtc = randr_screen_info->outputs[i]->cur_crtc; + randr_screen_info->cur_output = randr_screen_info->outputs[i]; + randr_screen_info->cur_output->auto_set = 0; + randr_screen_info->cur_output->off_set = 1; + output_off(randr_screen_info, randr_screen_info->cur_output); + main_low_apply(randr_screen_info); + + screenDeactivated = 1; + } + + if (screenDeactivated == 1) { + findPrimaryDisplay(); + refresh(); + + currentScreen()->proposeSize(GetDefaultResolutionParameter()); + currentScreen()->applyProposed(); + } + } menu->clear(); menu->setCheckable(true); @@ -89,12 +157,19 @@ void KRandRSystemTray::contextMenuAboutToShow(KPopupMenu* menu) populateMenu(menu); } - menu->insertSeparator(); + addOutputMenu(menu); + + menu->insertTitle(SmallIcon("randr"), i18n("Global Configuation")); + +// KAction *actPrefs = new KAction( i18n( "Configure Display..." ), +// SmallIconSet( "configure" ), KShortcut(), this, SLOT( slotPrefs() ), +// actionCollection() ); +// actPrefs->plug( menu ); - KAction *actPrefs = new KAction( i18n( "Configure Display..." ), - SmallIconSet( "configure" ), KShortcut(), this, SLOT( slotPrefs() ), + KAction *actSKeys = new KAction( i18n( "Configure Shortcut Keys..." ), + SmallIconSet( "configure" ), KShortcut(), this, SLOT( slotSKeys() ), actionCollection() ); - actPrefs->plug( menu ); + actSKeys->plug( menu ); menu->insertItem(SmallIcon("help"),KStdGuiItem::help().text(), m_help->menu()); KAction *quitAction = actionCollection()->action(KStdAction::name(KStdAction::Quit)); @@ -121,6 +196,36 @@ void KRandRSystemTray::configChanged() first = false; } +int KRandRSystemTray::GetDefaultResolutionParameter() +{ + int returnIndex = 0; + + int numSizes = currentScreen()->numSizes(); + int* sizeSort = new int[numSizes]; + + for (int i = 0; i < numSizes; i++) { + sizeSort[i] = currentScreen()->pixelCount(i); + } + + int highest = -1, highestIndex = -1; + + for (int i = 0; i < numSizes; i++) { + if (sizeSort[i] && sizeSort[i] > highest) { + highest = sizeSort[i]; + highestIndex = i; + } + } + sizeSort[highestIndex] = -1; + Q_ASSERT(highestIndex != -1); + + returnIndex = highestIndex; + + delete [] sizeSort; + sizeSort = 0L; + + return returnIndex; +} + void KRandRSystemTray::populateMenu(KPopupMenu* menu) { int lastIndex = 0; @@ -194,8 +299,15 @@ void KRandRSystemTray::populateMenu(KPopupMenu* menu) void KRandRSystemTray::slotResolutionChanged(int parameter) { - if (currentScreen()->currentSize() == parameter) +// if (currentScreen()->currentSize() == parameter) +// return; + + if (currentScreen()->currentSize() == parameter) { + //printf("This resolution is already in use; applying again...\n\r"); + currentScreen()->proposeSize(parameter); + currentScreen()->applyProposed(); return; + } currentScreen()->proposeSize(parameter); @@ -247,7 +359,347 @@ void KRandRSystemTray::slotPrefs() { KCMultiDialog *kcm = new KCMultiDialog( KDialogBase::Plain, i18n( "Configure" ), this ); - kcm->addModule( "display" ); + kcm->addModule( "displayconfig" ); kcm->setPlainCaption( i18n( "Configure Display" ) ); kcm->exec(); } + +void KRandRSystemTray::slotSettingsChanged(int category) +{ + if ( category == (int) KApplication::SETTINGS_SHORTCUTS ) { + globalKeys->readSettings(); + globalKeys->updateConnections(); + } +} + +void KRandRSystemTray::slotSKeys() +{ + ConfigDialog *dlg = new ConfigDialog(globalKeys, true); + + if ( dlg->exec() == QDialog::Accepted ) { + dlg->commitShortcuts(); + globalKeys->writeSettings(0, true); + globalKeys->updateConnections(); + } + + delete dlg; +} + +void KRandRSystemTray::slotCycleDisplays() +{ + XRROutputInfo *output_info; + char *output_name; + RROutput output_id; + int i; + int lastIndex = 0; + int current_on_index = -1; + int max_index = -1; + int prev_on_index; + Status s; + + randr_screen_info = read_screen_info(randr_display); + + for (i = 0; i < randr_screen_info->n_output; i++) { + output_info = randr_screen_info->outputs[i]->info; + // Look for ON outputs... + if (!randr_screen_info->outputs[i]->cur_crtc) { + continue; + } + // ...that are connected + if (RR_Disconnected == randr_screen_info->outputs[i]->info->connection) { + continue; + } + + output_name = output_info->name; + output_id = randr_screen_info->outputs[i]->id; + current_on_index = i; + if (i > max_index) { + max_index = i; + } + } + + for (i = 0; i < randr_screen_info->n_output; i++) { + output_info = randr_screen_info->outputs[i]->info; + // Look for CONNECTED outputs.... + if (RR_Disconnected == randr_screen_info->outputs[i]->info->connection) { + continue; + } + // ...that are not ON + if (randr_screen_info->outputs[i]->cur_crtc) { + continue; + } + + output_name = output_info->name; + output_id = randr_screen_info->outputs[i]->id; + if (i > max_index) { + max_index = i; + } + } + + for (i = 0; i < randr_screen_info->n_output; i++) { + output_info = randr_screen_info->outputs[i]->info; + // Look for ALL outputs that are not connected.... + if (RR_Disconnected != randr_screen_info->outputs[i]->info->connection) { + continue; + } + // ...or ON + if (randr_screen_info->outputs[i]->cur_crtc) { + continue; + } + + output_name = output_info->name; + output_id = randr_screen_info->outputs[i]->id; + if (i > max_index) { + max_index = i; + } + } + + printf("Active: %d\n\r", current_on_index); + printf("Max: %d\n\r", max_index); + + if ((current_on_index == -1) && (max_index == -1)) { + // There is no connected display available! ABORT + return; + } + + prev_on_index = current_on_index; + current_on_index = current_on_index + 1; + if (current_on_index > max_index) { + current_on_index = 0; + } + while (RR_Disconnected == randr_screen_info->outputs[current_on_index]->info->connection) { + current_on_index = current_on_index + 1; + if (current_on_index > max_index) { + current_on_index = 0; + } + } + if (prev_on_index != current_on_index) { + randr_screen_info->cur_crtc = randr_screen_info->outputs[current_on_index]->cur_crtc; + randr_screen_info->cur_output = randr_screen_info->outputs[current_on_index]; + randr_screen_info->cur_output->auto_set = 1; + randr_screen_info->cur_output->off_set = 0; + output_auto (randr_screen_info, randr_screen_info->cur_output); + i=main_low_apply(randr_screen_info); + + if (randr_screen_info->outputs[current_on_index]->cur_crtc) { + if (prev_on_index != -1) { + if (randr_screen_info->outputs[prev_on_index]->cur_crtc != NULL) { + if (RR_Disconnected != randr_screen_info->outputs[prev_on_index]->info->connection) { + randr_screen_info->cur_crtc = randr_screen_info->outputs[prev_on_index]->cur_crtc; + randr_screen_info->cur_output = randr_screen_info->outputs[prev_on_index]; + randr_screen_info->cur_output->auto_set = 0; + randr_screen_info->cur_output->off_set = 1; + output_off(randr_screen_info, randr_screen_info->cur_output); + i=main_low_apply(randr_screen_info); + } + } + } + + // Do something about the disconnected outputs + for (i = 0; i < randr_screen_info->n_output; i++) { + output_info = randr_screen_info->outputs[i]->info; + // Look for ON outputs + if (!randr_screen_info->outputs[i]->cur_crtc) { + continue; + } + if (RR_Disconnected != randr_screen_info->outputs[i]->info->connection) { + continue; + } + + output_name = output_info->name; + output_id = randr_screen_info->outputs[i]->id; + + // Deactivate this display to avoid a crash! + randr_screen_info->cur_crtc = randr_screen_info->outputs[i]->cur_crtc; + randr_screen_info->cur_output = randr_screen_info->outputs[i]; + randr_screen_info->cur_output->auto_set = 0; + randr_screen_info->cur_output->off_set = 1; + output_off(randr_screen_info, randr_screen_info->cur_output); + main_low_apply(randr_screen_info); + } + + findPrimaryDisplay(); + refresh(); + + currentScreen()->proposeSize(GetDefaultResolutionParameter()); + currentScreen()->applyProposed(); + } + else { + output_name = randr_screen_info->outputs[current_on_index]->info->name; + KMessageBox::sorry(my_parent, i18n("<b>Unable to activate output %1</b><p>Either the output is not connected to a display,<br>or the display configuration is not detectable").arg(output_name), i18n("Output Unavailable")); + } + } +} + +void KRandRSystemTray::findPrimaryDisplay() +{ + XRROutputInfo *output_info; + char *output_name; + RROutput output_id; + int i; + int lastIndex = 0; + + for (i = 0; i < randr_screen_info->n_output; i++) { + output_info = randr_screen_info->outputs[i]->info; + // Look for ON outputs... + if (!randr_screen_info->outputs[i]->cur_crtc) { + continue; + } + + // ...that are connected + if (RR_Disconnected == randr_screen_info->outputs[i]->info->connection) { + continue; + } + + output_name = output_info->name; + output_id = randr_screen_info->outputs[i]->id; + printf("ACTIVE CHECK: Found output %s\n\r", output_name); + + randr_screen_info->cur_crtc = randr_screen_info->outputs[i]->cur_crtc; + randr_screen_info->cur_output = randr_screen_info->outputs[i]; + } +} + +void KRandRSystemTray::addOutputMenu(KPopupMenu* menu) +{ + XRROutputInfo *output_info; + char *output_name; + RROutput output_id; + int i; + int lastIndex = 0; + int connected_displays = 0; + + if (isValid() == true) { + menu->insertTitle(SmallIcon("kcmkwm"), i18n("Output Port")); + + for (i = 0; i < randr_screen_info->n_output; i++) { + output_info = randr_screen_info->outputs[i]->info; + // Look for ON outputs + if (!randr_screen_info->outputs[i]->cur_crtc) { + continue; + } + if (RR_Disconnected == randr_screen_info->outputs[i]->info->connection) { + continue; + } + + output_name = output_info->name; + output_id = randr_screen_info->outputs[i]->id; + //printf("ON: Found output %s\n\r", output_name); + + lastIndex = menu->insertItem(i18n("%1 (Active)").arg(output_name)); + menu->setItemChecked(lastIndex, true); + menu->connectItem(lastIndex, this, SLOT(slotOutputChanged(int))); + menu->setItemParameter(lastIndex, i); + + connected_displays++; + } + + for (i = 0; i < randr_screen_info->n_output; i++) { + output_info = randr_screen_info->outputs[i]->info; + // Look for CONNECTED outputs.... + if (RR_Disconnected == randr_screen_info->outputs[i]->info->connection) { + continue; + } + // ...that are not ON + if (randr_screen_info->outputs[i]->cur_crtc) { + continue; + } + + output_name = output_info->name; + output_id = randr_screen_info->outputs[i]->id; + //printf("CONNECTED, NOT ON: Found output %s\n\r", output_name); + + lastIndex = menu->insertItem(i18n("%1 (Connected, Inactive)").arg(output_name)); + menu->setItemChecked(lastIndex, false); + menu->connectItem(lastIndex, this, SLOT(slotOutputChanged(int))); + menu->setItemParameter(lastIndex, i); + + connected_displays++; + } + + for (i = 0; i < randr_screen_info->n_output; i++) { + output_info = randr_screen_info->outputs[i]->info; + // Look for ALL outputs that are not connected.... + if (RR_Disconnected != randr_screen_info->outputs[i]->info->connection) { + continue; + } + // ...or ON + if (randr_screen_info->outputs[i]->cur_crtc) { + continue; + } + + output_name = output_info->name; + output_id = randr_screen_info->outputs[i]->id; + //printf("DISCONNECTED, NOT ON: Found output %s\n\r", output_name); + + lastIndex = menu->insertItem(i18n("%1 (Disconnected, Inactive)").arg(output_name)); + menu->setItemChecked(lastIndex, false); + menu->setItemEnabled(lastIndex, false); + menu->connectItem(lastIndex, this, SLOT(slotOutputChanged(int))); + menu->setItemParameter(lastIndex, i); + } + + lastIndex = menu->insertItem(SmallIcon("forward"), i18n("Next available output")); + if (connected_displays < 2) { + menu->setItemEnabled(lastIndex, false); + } + menu->connectItem(lastIndex, this, SLOT(slotCycleDisplays())); + } +} + +void KRandRSystemTray::slotOutputChanged(int parameter) +{ + XRROutputInfo *output_info; + char *output_name; + RROutput output_id; + int i; + Status s; + int num_outputs_on; + + num_outputs_on = 0; + for (i = 0; i < randr_screen_info->n_output; i++) { + output_info = randr_screen_info->outputs[i]->info; + // Look for ON outputs + if (!randr_screen_info->outputs[i]->cur_crtc) { + continue; + } + + num_outputs_on++; + } + + if (!randr_screen_info->outputs[parameter]->cur_crtc) { + //printf("Screen was off, turning it on...\n\r"); + + randr_screen_info->cur_crtc = randr_screen_info->outputs[parameter]->cur_crtc; + randr_screen_info->cur_output = randr_screen_info->outputs[parameter]; + randr_screen_info->cur_output->auto_set = 1; + randr_screen_info->cur_output->off_set = 0; + output_auto (randr_screen_info, randr_screen_info->cur_output); + i=main_low_apply(randr_screen_info); + + if (!randr_screen_info->outputs[parameter]->cur_crtc) { + output_name = randr_screen_info->outputs[parameter]->info->name; + KMessageBox::sorry(my_parent, i18n("<b>Unable to activate output %1</b><p>Either the output is not connected to a display,<br>or the display configuration is not detectable").arg(output_name), i18n("Output Unavailable")); + } + } + else { + if (num_outputs_on > 1) { + //printf("Screen was on, turning it off...\n\r"); + randr_screen_info->cur_crtc = randr_screen_info->outputs[parameter]->cur_crtc; + randr_screen_info->cur_output = randr_screen_info->outputs[parameter]; + randr_screen_info->cur_output->auto_set = 0; + randr_screen_info->cur_output->off_set = 1; + output_off(randr_screen_info, randr_screen_info->cur_output); + i=main_low_apply(randr_screen_info); + + findPrimaryDisplay(); + refresh(); + + currentScreen()->proposeSize(GetDefaultResolutionParameter()); + currentScreen()->applyProposed(); + } + else { + KMessageBox::sorry(my_parent, i18n("<b>You are attempting to deactivate the only active output</b><p>You must keep at least one display output active at all times!"), i18n("Invalid Operation Requested")); + } + } +}
\ No newline at end of file diff --git a/kcontrol/randr/krandrtray.h b/kcontrol/randr/krandrtray.h index 829306437..9387f8cad 100644 --- a/kcontrol/randr/krandrtray.h +++ b/kcontrol/randr/krandrtray.h @@ -22,9 +22,12 @@ #include <qptrlist.h> #include <ksystemtray.h> +#include <kglobalaccel.h> #include "randr.h" +#include "lowlevel_randr.h" + class KHelpMenu; class KPopupMenu; @@ -34,6 +37,7 @@ class KRandRSystemTray : public KSystemTray, public RandRDisplay public: KRandRSystemTray(QWidget* parent = 0, const char *name = 0); + KGlobalAccel *globalKeys; virtual void contextMenuAboutToShow(KPopupMenu* menu); @@ -45,16 +49,27 @@ protected slots: void slotOrientationChanged(int parameter); void slotRefreshRateChanged(int parameter); void slotPrefs(); + void slotSKeys(); + void slotSettingsChanged(int category); + void slotCycleDisplays(); + void slotOutputChanged(int parameter); protected: void mousePressEvent( QMouseEvent *e ); private: void populateMenu(KPopupMenu* menu); + void addOutputMenu(KPopupMenu* menu); + int GetDefaultResolutionParameter(); + void findPrimaryDisplay(); bool m_popupUp; KHelpMenu* m_help; QPtrList<KPopupMenu> m_screenPopups; + + Display *randr_display; + ScreenInfo *randr_screen_info; + QWidget* my_parent; }; #endif diff --git a/kcontrol/randr/lowlevel_randr.c b/kcontrol/randr/lowlevel_randr.c new file mode 100644 index 000000000..a6d54dbcd --- /dev/null +++ b/kcontrol/randr/lowlevel_randr.c @@ -0,0 +1,700 @@ +/* + * Copyright © 2007 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +#include "lowlevel_randr.h" +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +Status crtc_disable (struct CrtcInfo *crtc); + +char * get_output_name (struct ScreenInfo *screen_info, RROutput id) +{ + char *output_name = NULL; + int i; + + for (i = 0; i < screen_info->n_output; i++) { + if (id == screen_info->outputs[i]->id) { + output_name = screen_info->outputs[i]->info->name; + } + } + + if (!output_name) { + output_name = "Unknown"; + } + + return output_name; +} + +XRRModeInfo * find_mode_by_xid (struct ScreenInfo *screen_info, RRMode mode_id) +{ + XRRModeInfo *mode_info = NULL; + XRRScreenResources *res; + int i; + + res = screen_info->res; + for (i = 0; i < res->nmode; i++) { + if (mode_id == res->modes[i].id) { + mode_info = &res->modes[i]; + break; + } + } + + return mode_info; +} + +static XRRCrtcInfo * find_crtc_by_xid (struct ScreenInfo *screen_info, RRCrtc crtc_id) +{ + XRRCrtcInfo *crtc_info; + Display *dpy; + XRRScreenResources *res; + + dpy = screen_info->dpy; + res = screen_info->res; + + crtc_info = XRRGetCrtcInfo (dpy, res, crtc_id); + + return crtc_info; +} + +int get_width_by_output_id (struct ScreenInfo *screen_info, RROutput output_id) +{ + struct OutputInfo *output_info; + struct CrtcInfo *crtc_info; + RRMode mode_id; + XRRModeInfo *mode_info; + int i; + int width = -1; + + for (i = 0; i < screen_info->n_output; i++) { + if (output_id == screen_info->outputs[i]->id) { + crtc_info = screen_info->outputs[i]->cur_crtc; + if (!crtc_info) { + width = 0; + break; + } + mode_id = crtc_info->cur_mode_id; + mode_info = find_mode_by_xid (screen_info, mode_id); + + width = mode_width (mode_info, crtc_info->cur_rotation); + + break; + } + } + + return width; +} + +int get_height_by_output_id (struct ScreenInfo *screen_info, RROutput output_id) +{ + struct OutputInfo *output_info; + struct CrtcInfo *crtc_info; + RRMode mode_id; + XRRModeInfo *mode_info; + int i; + int height = -1; + + for (i = 0; i < screen_info->n_output; i++) { + if (output_id == screen_info->outputs[i]->id) { + crtc_info = screen_info->outputs[i]->cur_crtc; + if (!crtc_info) { + height = 0; + break; + } + mode_id = crtc_info->cur_mode_id; + mode_info = find_mode_by_xid (screen_info, mode_id); + + height = mode_height (mode_info, crtc_info->cur_rotation); + + break; + } + } + + return height; +} + +int mode_height (XRRModeInfo *mode_info, Rotation rotation) +{ + switch (rotation & 0xf) { + case RR_Rotate_0: + case RR_Rotate_180: + return mode_info->height; + case RR_Rotate_90: + case RR_Rotate_270: + return mode_info->width; + default: + return 0; + } +} + +int mode_width (XRRModeInfo *mode_info, Rotation rotation) +{ + switch (rotation & 0xf) { + case RR_Rotate_0: + case RR_Rotate_180: + return mode_info->width; + case RR_Rotate_90: + case RR_Rotate_270: + return mode_info->height; + default: + return 0; + } +} + + +static struct CrtcInfo * find_crtc (struct ScreenInfo *screen_info, XRROutputInfo *output) +{ + struct CrtcInfo *crtc_info = NULL; + int i; + + for (i = 0; i < screen_info->n_crtc; i++) { + if (screen_info->crtcs[i]->id == output->crtc) { + crtc_info = screen_info->crtcs[i]; + break; + } + } + + return crtc_info; +} + +struct CrtcInfo * auto_find_crtc (struct ScreenInfo *screen_info, struct OutputInfo *output_info) +{ + struct CrtcInfo *crtc_info = NULL; + int i; + + for (i = 0; i < screen_info->n_crtc; i++) { + if (0 == screen_info->crtcs[i]->cur_noutput) { + crtc_info = screen_info->crtcs[i]; + break; + } + } + + if (NULL == crtc_info) { + crtc_info = screen_info->crtcs[0]; + } + + return crtc_info; +} + +int set_screen_size (struct ScreenInfo *screen_info) +{ + Display *dpy; + int screen; + struct CrtcInfo *crtc; + XRRModeInfo *mode_info; + int cur_x = 0, cur_y = 0; + int w = 0, h = 0; + int mmW, mmH; + int max_width = 0, max_height = 0; + int i; + + dpy = screen_info->dpy; + screen = DefaultScreen (dpy); + + for (i = 0; i < screen_info->n_crtc; i++) { + crtc = screen_info->crtcs[i]; + if (!crtc->cur_mode_id) { + continue; + } + mode_info = find_mode_by_xid (screen_info, crtc->cur_mode_id); + cur_x = crtc->cur_x; + cur_y = crtc->cur_y; + + w = mode_width (mode_info, crtc->cur_rotation); + h = mode_height (mode_info, crtc->cur_rotation); + + if (cur_x + w > max_width) { + max_width = cur_x + w; + } + if (cur_y + h > max_height) { + max_height = cur_y + h; + } + } + + if (max_width > screen_info->max_width) { + #if RANDR_GUI_DEBUG + fprintf (stderr, "user set screen width %d, larger than max width %d, set to max width\n", + cur_x + w, screen_info->max_width); + #endif + return 0; + } else if (max_width < screen_info->min_width) { + screen_info->cur_width = screen_info->min_width; + } else { + screen_info->cur_width = max_width; + } + + if (max_height > screen_info->max_height) { + #if RANDR_GUI_DEBUG + fprintf (stderr, "user set screen height %d, larger than max height %d, set to max height\n", + cur_y + h, screen_info->max_height); + #endif + return 0; + } else if (max_height < screen_info->min_height) { + screen_info->cur_height = screen_info->min_height; + } else { + screen_info->cur_height = max_height; + } + + /* calculate mmWidth, mmHeight */ + if (screen_info->cur_width != DisplayWidth (dpy, screen) || + screen_info->cur_height != DisplayHeight (dpy, screen) ) { + double dpi; + + dpi = (25.4 * DisplayHeight (dpy, screen)) / DisplayHeightMM(dpy, screen); + mmW = (25.4 * screen_info->cur_width) / dpi; + mmH = (25.4 * screen_info->cur_height) / dpi; + } else { + mmW = DisplayWidthMM (dpy, screen); + mmH = DisplayHeightMM (dpy, screen); + } + + screen_info->cur_mmWidth = mmW; + screen_info->cur_mmHeight = mmH; + + return 1; +} + +void screen_apply (struct ScreenInfo *screen_info) +{ + int width, height; + int mmWidth, mmHeight; + Display *dpy, *cur_dpy; + Window window; + int screen; + static int first = 1; + + width = screen_info->cur_width; + height = screen_info->cur_height; + mmWidth = screen_info->cur_mmWidth; + mmHeight = screen_info->cur_mmHeight; + dpy = screen_info->dpy; + window = screen_info->window; + screen = DefaultScreen (dpy); + + cur_dpy = XOpenDisplay (NULL); + + if (width == DisplayWidth (cur_dpy, screen) && + height == DisplayHeight (cur_dpy, screen) && + mmWidth == DisplayWidthMM (cur_dpy, screen) && + mmHeight == DisplayHeightMM (cur_dpy, screen) ) { + return; + } else { + XRRSetScreenSize (dpy, window, width, height, mmWidth, mmHeight); + } +} + +Status crtc_apply (struct CrtcInfo *crtc_info) +{ + struct ScreenInfo *screen_info; + XRRCrtcInfo *rr_crtc_info; + Display *dpy; + XRRScreenResources *res; + RRCrtc crtc_id; + int x, y; + RRMode mode_id; + Rotation rotation; + RROutput *outputs; + int noutput; + Status s; + int i; + + /*if (!crtc_info->changed) { + return RRSetConfigSuccess; + }*/ + + screen_info = crtc_info->screen_info; + dpy = screen_info->dpy; + res = screen_info->res; + crtc_id = crtc_info->id; + x = crtc_info->cur_x; + y = crtc_info->cur_y; + + mode_id = crtc_info->cur_mode_id; + rotation = crtc_info->cur_rotation; + + noutput = crtc_info->cur_noutput; + + if (0 == noutput) { + return crtc_disable (crtc_info); + } + + outputs = malloc (sizeof (RROutput) * noutput); + noutput = 0; + for (i = 0; i < screen_info->n_output; i++) { + struct OutputInfo *output_info = screen_info->outputs[i]; + + if (output_info->cur_crtc && crtc_id == output_info->cur_crtc->id) { + outputs[noutput++] = output_info->id; + } + } + + + s = XRRSetCrtcConfig (dpy, res, crtc_id, CurrentTime, + x, y, mode_id, rotation, + outputs, noutput); + + if (RRSetConfigSuccess == s) { + crtc_info->changed = 0; + } + + free (outputs); + + return s; +} + +Status crtc_disable (struct CrtcInfo *crtc) +{ + struct ScreenInfo *screen_info; + + screen_info = crtc->screen_info; + + return XRRSetCrtcConfig (screen_info->dpy, screen_info->res, crtc->id, CurrentTime, + 0, 0, None, RR_Rotate_0, NULL, 0); +} + +struct ScreenInfo* read_screen_info (Display *display) +{ + struct ScreenInfo *screen_info; + int screen_num; + Window root_window; + XRRScreenResources *sr; + int i; + + screen_num = DefaultScreen (display); + root_window = RootWindow (display, screen_num); + + sr = XRRGetScreenResources (display, root_window); + + screen_info = malloc (sizeof (struct ScreenInfo)); + screen_info->dpy = display; + screen_info->window = root_window; + screen_info->res = sr; + screen_info->cur_width = DisplayWidth (display, screen_num); + screen_info->cur_height = DisplayHeight (display, screen_num); + screen_info->cur_mmWidth = DisplayWidthMM (display, screen_num); + screen_info->cur_mmHeight = DisplayHeightMM (display, screen_num); + screen_info->n_output = sr->noutput; + screen_info->n_crtc = sr->ncrtc; + screen_info->outputs = malloc (sizeof (struct OutputInfo *) * sr->noutput); + screen_info->crtcs = malloc (sizeof (struct CrtcInfo *) * sr->ncrtc); + screen_info->clone = 0; + + XRRGetScreenSizeRange (display, root_window, &screen_info->min_width, &screen_info->min_height, &screen_info->max_width, &screen_info->max_height); + + /* get crtc */ + for (i = 0; i < sr->ncrtc; i++) { + struct CrtcInfo *crtc_info; + screen_info->crtcs[i] = malloc (sizeof (struct CrtcInfo)); + crtc_info = screen_info->crtcs[i]; + XRRCrtcInfo *xrr_crtc_info = XRRGetCrtcInfo (display, sr, sr->crtcs[i]); + + crtc_info->id = sr->crtcs[i]; + crtc_info->info = xrr_crtc_info; + crtc_info->cur_x = xrr_crtc_info->x; + crtc_info->cur_y = xrr_crtc_info->y; + crtc_info->cur_mode_id = xrr_crtc_info->mode; + crtc_info->cur_rotation = xrr_crtc_info->rotation; + crtc_info->rotations = xrr_crtc_info->rotations; + crtc_info->cur_noutput = xrr_crtc_info->noutput; + + crtc_info->changed = 0; + crtc_info->screen_info = screen_info; + } + + + /* get output */ + for (i = 0; i < sr->noutput; i++) { + struct OutputInfo *output; + screen_info->outputs[i] = malloc (sizeof (struct OutputInfo)); + output = screen_info->outputs[i]; + + output->id = sr->outputs[i]; + output->info = XRRGetOutputInfo (display, sr, sr->outputs[i]); + output->cur_crtc = find_crtc (screen_info, output->info); + output->auto_set = 0; + if (output->cur_crtc) { + output->off_set = 0; + } else { + output->off_set = 1; + } + + } + + /* set current crtc */ + screen_info->cur_crtc = screen_info->outputs[0]->cur_crtc; + screen_info->primary_crtc = screen_info->cur_crtc; + screen_info->cur_output = screen_info->outputs[0]; + + return screen_info; +} + +void free_screen_info (struct ScreenInfo *screen_info) +{ + free (screen_info->outputs); + free (screen_info->crtcs); + free (screen_info); +} + + + +static char * get_mode_name (struct ScreenInfo *screen_info, RRMode mode_id) +{ + XRRScreenResources *sr; + char *mode_name = NULL; + int i; + + sr = screen_info->res; + + for (i = 0; i < sr->nmode; i++) { + if (sr->modes[i].id == mode_id) { + break; + } + } + + if (i == sr->nmode) { + mode_name = g_strdup ("Unknown mode"); + } else { + double rate; + if (sr->modes[i].hTotal && sr->modes[i].vTotal) { + rate = ((double) sr->modes[i].dotClock / + ((double) sr->modes[i].hTotal * (double) sr->modes[i].vTotal)); + } else { + rate = 0; + } + mode_name = g_strdup_printf ("%s%6.1fHz", sr->modes[i].name, rate); + } + + return mode_name; +} + +/*check if other outputs that connected to the same crtc support this mode*/ +static int check_mode (struct ScreenInfo *screen_info, struct OutputInfo *output, RRMode mode_id) +{ + XRRCrtcInfo *crtc_info; + /* XRR */ + int i, j; + int mode_ok = 1; + + if (!output->cur_crtc) { + return 1; + } + + crtc_info = output->cur_crtc->info; + for (i = 0; i < crtc_info->noutput; i++) { + XRROutputInfo *output_info; + int nmode; + + if (output->id == crtc_info->outputs[i]) { + continue; + } + + mode_ok = 0; + output_info = XRRGetOutputInfo (screen_info->dpy, screen_info->res, crtc_info->outputs[i]); + nmode = output_info->nmode; + for (j = 0; j < nmode; j++) { + if (mode_id == output_info->modes[j]) { + mode_ok = 1; + break; + } + } + if (!mode_ok) { + break; + } + } + + return mode_ok; +} + +static RRCrtc get_crtc_id_by_output_id (struct ScreenInfo *screen_info, RROutput output_id) +{ + int i; + RRCrtc crtc_id = -1; + + for (i = 0; i < screen_info->n_output; i++) { + if (output_id == screen_info->outputs[i]->id) { + if (screen_info->outputs[i]->cur_crtc) { + crtc_id = screen_info->outputs[i]->cur_crtc->id; + } else { + crtc_id = 0; /* this output is off */ + } + break; + } + } + + return crtc_id; +} + +static struct CrtcInfo * +get_crtc_info_by_xid (struct ScreenInfo *screen_info, RRCrtc crtc_id) +{ + struct CrtcInfo *crtc_info = NULL; + int i; + + for (i = 0; i < screen_info->n_crtc; i++) { + if (crtc_id == screen_info->crtcs[i]->id) { + crtc_info = screen_info->crtcs[i]; + break; + } + } + + return crtc_info; +} + +static XRRModeInfo * +preferred_mode (struct ScreenInfo *screen_info, struct OutputInfo *output) +{ + XRROutputInfo *output_info = output->info; + Display *dpy; + int screen; + int m; + XRRModeInfo *best; + int bestDist; + + dpy = screen_info->dpy; + screen = DefaultScreen (dpy); + best = NULL; + bestDist = 0; + for (m = 0; m < output_info->nmode; m++) { + XRRModeInfo *mode_info = find_mode_by_xid (screen_info, output_info->modes[m]); + int dist; + + if (m < output_info->npreferred) + dist = 0; + else if (output_info->mm_height) + dist = (1000 * DisplayHeight(dpy, screen) / DisplayHeightMM(dpy, screen) - + 1000 * mode_info->height / output_info->mm_height); + else + dist = DisplayHeight(dpy, screen) - mode_info->height; + + if (dist < 0) dist = -dist; + if (!best || dist < bestDist) { + best = mode_info; + bestDist = dist; + } + } + return best; +} + +int main_low_apply (struct ScreenInfo *screen_info) +{ + int i; + struct CrtcInfo *crtc_info; + + /* set_positions (screen_info); */ + + if (!set_screen_size (screen_info)) { + printf("Screen Size FAILURE\n\r"); + return 0; + } + + for (i = 0; i < screen_info->n_crtc; i++) { + int old_x, old_y, old_w, old_h; + + XRRCrtcInfo *crtc_info = XRRGetCrtcInfo (screen_info->dpy, screen_info->res, screen_info->crtcs[i]->id); + XRRModeInfo *old_mode = find_mode_by_xid (screen_info, crtc_info->mode); + + if (crtc_info->mode == None) { + continue; + } + + old_x = crtc_info->x; + old_y = crtc_info->y; + old_w = mode_width (old_mode, crtc_info->rotation); + old_h = mode_height (old_mode, crtc_info->rotation); + + if (old_x + old_w <= screen_info->cur_width && + old_y + old_h <= screen_info->cur_height ) { + continue; + } else { + crtc_disable (screen_info->crtcs[i]); + } + } + + screen_apply (screen_info); + + for (i = 0; i < screen_info->n_crtc; i++) { + Status s; + crtc_info = screen_info->crtcs[i]; + + s = crtc_apply (crtc_info); + if (RRSetConfigSuccess != s) { + fprintf (stderr, "crtc apply error\n"); + } + } + + return 1; +} + +void output_auto (struct ScreenInfo *screen_info, struct OutputInfo *output_info) +{ + XRRModeInfo *mode_info; + RRMode mode_id; + struct CrtcInfo *crtc_info; + XRROutputInfo *probe_output_info; + + if (RR_Disconnected == output_info->info->connection) { + XRRScreenResources *cur_res; + + cur_res = XRRGetScreenResources (screen_info->dpy, screen_info->window); + probe_output_info = XRRGetOutputInfo (screen_info->dpy, cur_res, output_info->id); + if (RR_Disconnected != probe_output_info->connection) { + output_info->info = probe_output_info; + output_info->cur_crtc = auto_find_crtc (screen_info, output_info); + } + } + + mode_info = preferred_mode (screen_info, output_info); + if (!mode_info) { + return; + } + mode_id = mode_info->id; + + crtc_info = output_info->cur_crtc; + if (crtc_info) { + crtc_info->cur_mode_id = mode_id; + } else { + crtc_info = auto_find_crtc (screen_info, output_info); + if (!crtc_info) { +#if RANDR_GUI_DEBUG + fprintf (stderr, "Can not find usable CRTC\n"); +#endif + return; + } else { + screen_info->cur_output->cur_crtc = crtc_info; + screen_info->cur_crtc = crtc_info; + screen_info->cur_crtc->cur_noutput++; + fprintf (stderr, "n output: %d\n", screen_info->cur_crtc->cur_noutput); + screen_info->cur_crtc->cur_mode_id = mode_id; + screen_info->cur_crtc->changed = 1; + } + } + +} + +void output_off (struct ScreenInfo *screen_info, struct OutputInfo *output) +{ + if (output->cur_crtc) { + output->cur_crtc->cur_noutput--; + } + output->cur_crtc = NULL; + screen_info->cur_crtc = NULL; + output->off_set = 1; +} diff --git a/kcontrol/randr/lowlevel_randr.h b/kcontrol/randr/lowlevel_randr.h new file mode 100644 index 000000000..a9a519125 --- /dev/null +++ b/kcontrol/randr/lowlevel_randr.h @@ -0,0 +1,102 @@ +/* + * Copyright © 2007 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include <X11/Xlib.h> +#include <X11/extensions/Xrandr.h> + +struct ScreenInfo; + +struct CrtcInfo { + RRCrtc id; + XRRCrtcInfo *info; + int cur_x; + int cur_y; + RRMode cur_mode_id; + Rotation cur_rotation; + Rotation rotations; + int cur_noutput; + + int changed; + + struct ScreenInfo *screen_info; +}; + +struct OutputInfo { + RROutput id; + XRROutputInfo *info; + struct CrtcInfo *cur_crtc; + + int auto_set; + int off_set; +}; + +struct ScreenInfo { + Display *dpy; + Window window; + XRRScreenResources *res; + int min_width, min_height; + int max_width, max_height; + int cur_width; + int cur_height; + int cur_mmWidth; + int cur_mmHeight; + + int n_output; + int n_crtc; + struct OutputInfo **outputs; + struct CrtcInfo **crtcs; + + int clone; + struct CrtcInfo *primary_crtc; + + struct CrtcInfo *cur_crtc; + struct OutputInfo *cur_output; +}; + +extern struct ScreenInfo *screen_info; +extern const uint big_pixbuf[], small_pixbuf[]; + +#ifdef __cplusplus +extern "C" { +#endif +void free_screen_info (struct ScreenInfo *screen_info); + +struct ScreenInfo* read_screen_info (Display *); + +int set_screen_size (struct ScreenInfo *screen_info); +void output_auto (struct ScreenInfo *screen_info, struct OutputInfo *output_info); +void output_off (struct ScreenInfo *screen_info, struct OutputInfo *output); +struct CrtcInfo* auto_find_crtc (struct ScreenInfo *screen_info, struct OutputInfo *output_info); + +XRRModeInfo *find_mode_by_xid (struct ScreenInfo *screen_info, RRMode mode_id); +int mode_height (XRRModeInfo *mode_info, Rotation rotation); +int mode_width (XRRModeInfo *mode_info, Rotation rotation); +int get_width_by_output_id (struct ScreenInfo *screen_info, RROutput output_id); +int get_height_by_output_id (struct ScreenInfo *screen_info, RROutput output_id); +char *get_output_name (struct ScreenInfo *screen_info, RROutput id); +Status crtc_apply (struct CrtcInfo *crtc_info); +Status crtc_disable (struct CrtcInfo *crtc); +int main_low_apply (struct ScreenInfo *screen_info); + +#ifdef __cplusplus +} +#endif
\ No newline at end of file diff --git a/kcontrol/samba/ksmbstatus.cpp b/kcontrol/samba/ksmbstatus.cpp index 4866a3a1e..b5bc6599f 100644 --- a/kcontrol/samba/ksmbstatus.cpp +++ b/kcontrol/samba/ksmbstatus.cpp @@ -136,7 +136,7 @@ void NetMon::slotReceivedData(KProcess *, char *buffer, int ) char s[250],*start,*end; size_t len; start = buffer; - while ((end = strchr(start,'\n'))) // look for '\n' + while ((end = (char*)strchr(start,'\n'))) // look for '\n' { len = end-start; if (len>=sizeof(s)) diff --git a/kcontrol/samba/smbstatus.desktop b/kcontrol/samba/smbstatus.desktop index c0b6db58a..14b8425ed 100644 --- a/kcontrol/samba/smbstatus.desktop +++ b/kcontrol/samba/smbstatus.desktop @@ -238,4 +238,5 @@ Keywords[xh]=SMB,SAMBA,umsebenzi womnatha wee window,LAN,Ulwazi lwendlela yokuse Keywords[zh_CN]=SMB,SAMBA,Windows network,LAN,System Information,局域网,系统信息 Keywords[zh_TW]=SMB,SAMBA,Windows network,LAN,System Information,Windows 網路,區域網路,系統資訊 Keywords[zu]=SMB,SAMBA,Uxhumano olusakazekile lwama-windows,LAN,Ulwazi lwesistimu -Categories=Qt;KDE;X-KDE-information; +Categories=Qt;KDE;X-KDE-settings-network; + diff --git a/kcontrol/style/kcmstyle.cpp b/kcontrol/style/kcmstyle.cpp index 9333c0f72..098990afd 100644 --- a/kcontrol/style/kcmstyle.cpp +++ b/kcontrol/style/kcmstyle.cpp @@ -229,6 +229,14 @@ KCMStyle::KCMStyle( QWidget* parent, const char* name ) containerLayout->addWidget( lblTooltipEffect, 1, 0 ); containerLayout->addWidget( comboTooltipEffect, 1, 1 ); + comboRubberbandEffect = new QComboBox( FALSE, containerFrame ); + comboRubberbandEffect->insertItem( i18n("Disable") ); + comboRubberbandEffect->insertItem( i18n("Make translucent") ); + lblRubberbandEffect = new QLabel( i18n("&Rubberband effect:"), containerFrame ); + lblRubberbandEffect->setBuddy( comboRubberbandEffect ); + containerLayout->addWidget( lblRubberbandEffect, 2, 0 ); + containerLayout->addWidget( comboRubberbandEffect, 2, 1 ); + comboMenuEffect = new QComboBox( FALSE, containerFrame ); comboMenuEffect->insertItem( i18n("Disable") ); comboMenuEffect->insertItem( i18n("Animate") ); @@ -236,8 +244,8 @@ KCMStyle::KCMStyle( QWidget* parent, const char* name ) comboMenuEffect->insertItem( i18n("Make Translucent") ); lblMenuEffect = new QLabel( i18n("&Menu effect:"), containerFrame ); lblMenuEffect->setBuddy( comboMenuEffect ); - containerLayout->addWidget( lblMenuEffect, 2, 0 ); - containerLayout->addWidget( comboMenuEffect, 2, 1 ); + containerLayout->addWidget( lblMenuEffect, 3, 0 ); + containerLayout->addWidget( comboMenuEffect, 3, 1 ); comboMenuHandle = new QComboBox( FALSE, containerFrame ); comboMenuHandle->insertItem( i18n("Disable") ); @@ -245,11 +253,11 @@ KCMStyle::KCMStyle( QWidget* parent, const char* name ) // comboMenuHandle->insertItem( i18n("Enable") ); lblMenuHandle = new QLabel( i18n("Me&nu tear-off handles:"), containerFrame ); lblMenuHandle->setBuddy( comboMenuHandle ); - containerLayout->addWidget( lblMenuHandle, 3, 0 ); - containerLayout->addWidget( comboMenuHandle, 3, 1 ); + containerLayout->addWidget( lblMenuHandle, 4, 0 ); + containerLayout->addWidget( comboMenuHandle, 4, 1 ); cbMenuShadow = new QCheckBox( i18n("Menu &drop shadow"), containerFrame ); - containerLayout->addWidget( cbMenuShadow, 4, 0 ); + containerLayout->addWidget( cbMenuShadow, 5, 0 ); // Push the [label combo] to the left. comboSpacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); @@ -359,6 +367,7 @@ KCMStyle::KCMStyle( QWidget* parent, const char* name ) connect( cbEnableEffects, SIGNAL(toggled(bool)), this, SLOT(setEffectsDirty())); connect( cbEnableEffects, SIGNAL(toggled(bool)), this, SLOT(setStyleDirty())); connect( comboTooltipEffect, SIGNAL(activated(int)), this, SLOT(setEffectsDirty())); + connect( comboRubberbandEffect, SIGNAL(activated(int)), this, SLOT(setStyleDirty())); connect( comboComboEffect, SIGNAL(activated(int)), this, SLOT(setEffectsDirty())); connect( comboMenuEffect, SIGNAL(activated(int)), this, SLOT(setStyleDirty())); connect( comboMenuHandle, SIGNAL(activated(int)), this, SLOT(setStyleDirty())); @@ -556,6 +565,11 @@ void KCMStyle::save() item = comboTooltipEffect->currentItem(); config.writeEntry( "EffectAnimateTooltip", item == 1); config.writeEntry( "EffectFadeTooltip", item == 2 ); + item = comboRubberbandEffect->currentItem(); + { + QSettings settings; // Only for KStyle stuff + settings.writeEntry("/KStyle/Settings/SemiTransparentRubberband", item == 1); + } item = comboMenuHandle->currentItem(); config.writeEntry( "InsertTearOffHandle", item ); item = comboMenuEffect->currentItem(); @@ -887,7 +901,11 @@ void KCMStyle::loadEffects( KConfig& config ) comboTooltipEffect->setCurrentItem( 2 ); else comboTooltipEffect->setCurrentItem( 0 ); - + + QSettings settings; + bool semiTransparentRubberband = settings.readBoolEntry("/KStyle/Settings/SemiTransparentRubberband", false); + comboRubberbandEffect->setCurrentItem( semiTransparentRubberband ? 1 : 0 ); + if ( config.readBoolEntry( "EffectAnimateMenu", false) ) comboMenuEffect->setCurrentItem( 1 ); else if ( config.readBoolEntry( "EffectFadeMenu", false) ) @@ -898,7 +916,7 @@ void KCMStyle::loadEffects( KConfig& config ) comboMenuHandle->setCurrentItem(config.readNumEntry("InsertTearOffHandle", 0)); // KStyle Menu transparency and drop-shadow options... - QSettings settings; + QString effectEngine = settings.readEntry("/KStyle/Settings/MenuTransparencyEngine", "Disabled"); #ifdef HAVE_XRENDER @@ -1027,6 +1045,8 @@ void KCMStyle::addWhatsThis() QWhatsThis::add( comboTooltipEffect, i18n( "<p><b>Disable: </b>do not use any tooltip effects.</p>\n" "<p><b>Animate: </b>Do some animation.</p>\n" "<b>Fade: </b>Fade in tooltips using alpha-blending.") ); + QWhatsThis::add( comboRubberbandEffect, i18n( "<p><b>Disable: </b>do not use any rubberband effects.</p>\n" + "<b>Make Translucent: </b>Draw a translucent rubberband.") ); QWhatsThis::add( comboMenuEffect, i18n( "<p><b>Disable: </b>do not use any menu effects.</p>\n" "<p><b>Animate: </b>Do some animation.</p>\n" "<p><b>Fade: </b>Fade in menus using alpha-blending.</p>\n" diff --git a/kcontrol/style/kcmstyle.h b/kcontrol/style/kcmstyle.h index fb2909b1a..6f6da6d1c 100644 --- a/kcontrol/style/kcmstyle.h +++ b/kcontrol/style/kcmstyle.h @@ -126,11 +126,13 @@ private: QFrame* containerFrame; QGridLayout* containerLayout; QComboBox* comboTooltipEffect; + QComboBox* comboRubberbandEffect; QComboBox* comboComboEffect; QComboBox* comboMenuEffect; QComboBox* comboMenuHandle; QLabel* lblTooltipEffect; + QLabel* lblRubberbandEffect; QLabel* lblComboEffect; QLabel* lblMenuEffect; QLabel* lblMenuHandle; diff --git a/kcontrol/usbview/kcmusb.desktop b/kcontrol/usbview/kcmusb.desktop index 0ae4500f2..76729bb5d 100644 --- a/kcontrol/usbview/kcmusb.desktop +++ b/kcontrol/usbview/kcmusb.desktop @@ -237,4 +237,4 @@ Keywords[zh_CN]=USB,devices,viewer,control,设备,查看器,控制 Keywords[zh_TW]=USB,devices,viewer,control,裝置,檢視器,控制 Keywords[zu]=USB,amathukuzi ananjongo,umbukisi,lawula -Categories=Qt;KDE;X-KDE-information; +Categories=Qt;KDE;X-KDE-settings-hardware; diff --git a/kcontrol/view1394/kcmview1394.desktop b/kcontrol/view1394/kcmview1394.desktop index 04a831f58..fb1b7ad79 100644 --- a/kcontrol/view1394/kcmview1394.desktop +++ b/kcontrol/view1394/kcmview1394.desktop @@ -216,4 +216,5 @@ Keywords[wa]=1394,IEEE 1394,Firewire,éndjins,håyneu,contrôle,corwaitaedje Keywords[zh_CN]=1394,Firewire,devices,viewer,control,设备,查看器,控制,火线 Keywords[zh_TW]=1394,Firewire,devices,viewer,control,裝置,檢視器,控制 -Categories=Qt;KDE;X-KDE-information; +Categories=Qt;KDE;X-KDE-settings-hardware; + |