[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/graphics/UNNAMED_READER
From: Stefan Kebekus <kebekus () kde ! org>
Date: 2007-01-04 9:14:32
Message-ID: 1167902072.610944.11112.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 619740 by kebekus:
added settings dialog
M +5 -1 UNNAMED_READER/CMakeLists.txt
M +1 -3 UNNAMED_READER/TODO
A UNNAMED_READER/UNNAMED_READERPrefs.kcfg
A UNNAMED_READER/UNNAMED_READERPrefs.kcfgc
M +30 -5 UNNAMED_READER/autoHideTabWidget.cpp
M +5 -1 UNNAMED_READER/autoHideTabWidget.h
M +21 -1 UNNAMED_READER/mainWindow.cpp
M +3 -0 UNNAMED_READER/mainWindow.h
A UNNAMED_READER/settingsWidget.ui
M +0 -1 corelibrary/dropObserver.cpp
--- trunk/playground/graphics/UNNAMED_READER/UNNAMED_READER/CMakeLists.txt \
#619739:619740 @@ -13,8 +13,12 @@
UNNAMED_READER_adaptor.cpp
)
+kde4_add_kcfg_files(UNNAMED_READER_SRCS UNNAMED_READERPrefs.kcfgc )
+
+kde4_add_ui_files(UNNAMED_READER_SRCS settingsWidget.ui )
+
kde4_automoc(${UNNAMED_READER_SRCS})
-
+
kde4_add_executable(UNNAMED_READER ${UNNAMED_READER_SRCS})
target_link_libraries(UNNAMED_READER UNNAMED_READERcore ${KDE4_KDECORE_LIBS} \
${KDE4_KPARTS_LIBS} )
--- trunk/playground/graphics/UNNAMED_READER/UNNAMED_READER/TODO #619739:619740
@@ -1,11 +1,9 @@
- drag from UNNAMED_READER
-- preferences, "hide tabBar automatically"
-
- add images to the tips
- mimetype handling
- window menu
-- Two tabs open, but only one readerWindow, then context menu on tabbar is nonsense
\ No newline at end of file
+- Two tabs open, but only one readerWindow, then context menu on tabbar is nonsense
--- trunk/playground/graphics/UNNAMED_READER/UNNAMED_READER/autoHideTabWidget.cpp \
#619739:619740 @@ -22,6 +22,7 @@
#include "mainWindow.h"
#include "readerWidget.h"
#include "UNNAMED_READER_debug.h"
+#include "UNNAMED_READERPrefs.h"
#include <kiconloader.h>
#include <klocale.h>
@@ -56,8 +57,11 @@
// React to context menu requests in the tabBar
connect(tabBar(), SIGNAL(customContextMenuRequested(const QPoint &)), this, \
SLOT(showPopupMenu(const QPoint &)));
+ // React to changes in preferences
+ connect(UNNAMED_READERPrefs::self(), SIGNAL(configChanged()), this, \
SLOT(checkGUI())); +
setTabReorderingEnabled( true );
-
+
addTab(new dropArea(this), QString::null);
}
@@ -108,6 +112,12 @@
}
+void autoHideTabWidget::mousePressEvent(QMouseEvent *event)
+{
+ kDebug(UNNAMED_READER_DEBUG, shell) << "autoHideTabWidget::mousePressEvent()" << \
endl; +}
+
+
void autoHideTabWidget::deleteCurrentTab()
{
kDebug(UNNAMED_READER_DEBUG, shell) << "autoHideTabWidget::deleteCurrentTab()" << \
endl; @@ -153,7 +163,9 @@
menu.addSeparator();
QAction *reloadAll = 0;
QAction *closeAll = 0;
- if (count() > 1) {
+
+ QList<readerWidget *> readers = findChildren<readerWidget *>();
+ if (readers.count() > 1) {
QMenu *other = menu.addMenu(i18n("Other Tabs"));
reloadAll = other->addAction(SmallIcon("reload"), i18n("Reload all documents"));
other->addSeparator();
@@ -274,9 +286,22 @@
// TabBar visibility will be set in the next call of this method.
if (count() == 0) {
addTab(new dropArea(this), QString::null);
+ tabBar()->hide();
+ tabBar()->setContextMenuPolicy(Qt::PreventContextMenu);
return;
}
+ // If there is only one widget, and if that widget is the
+ // dropArea, then hide the tabBar under all circumstances.
+ if (count() == 1) {
+ QWidget *wdg = widget(0);
+ if ((wdg == 0) || wdg->inherits("UNNAMED_READER::dropArea")) {
+ tabBar()->hide();
+ tabBar()->setContextMenuPolicy(Qt::PreventContextMenu);
+ return;
+ }
+ }
+
// If there is more than one widget, we don't want a
// dropArea. Remove it. This method will be called again
// immediately, so there is no need to look for more than one
@@ -288,12 +313,12 @@
if ((wdg == 0) || (!wdg->inherits("UNNAMED_READER::dropArea")))
continue;
delete wdg;
- return;
+ break;
}
} // If count() > 1
-
+
// Show or hide the tabBar
- if (count() < 2) {
+ if ((count() < 2) && UNNAMED_READERPrefs::autoHideTabBar()) {
tabBar()->hide();
tabBar()->setContextMenuPolicy(Qt::PreventContextMenu);
} else {
--- trunk/playground/graphics/UNNAMED_READER/UNNAMED_READER/autoHideTabWidget.h \
#619739:619740 @@ -92,6 +92,11 @@
*/
virtual void tabRemoved(int index);
+ /**
+ * Re-implemented from QWidget to support drag-and-drop
+ */
+ virtual void mousePressEvent(QMouseEvent *event);
+
private slots:
/**
* Shows a popup menu in the tabBar
@@ -104,7 +109,6 @@
*/
void setTabNameAndToolTip(readerWidget *wdg);
- private:
/**
* This method will make the necessary changes to the GUI when the
* number of children chenges. For instance, it will show the tabBar
--- trunk/playground/graphics/UNNAMED_READER/UNNAMED_READER/mainWindow.cpp \
#619739:619740 @@ -21,10 +21,13 @@
#include "fileFormats.h"
#include "mainWindow.h"
#include "readerWidget.h"
+#include "ui_settingsWidget.h"
#include "UNNAMED_READER_debug.h"
#include "UNNAMED_READER_adaptor.h"
+#include "UNNAMED_READERPrefs.h"
#include <kapplication.h>
+#include <kconfigdialog.h>
#include <kfiledialog.h>
#include <kicon.h>
#include <klocale.h>
@@ -125,6 +128,21 @@
}
+void mainWindow::editSettings()
+{
+ // The preference dialog is derived from prefs_base.ui
+ //
+ // compare the names of the widgets in the .ui file
+ // to the names of the variables in the .kcfg file
+ KConfigDialog *dialog = new KConfigDialog(this, "settings", \
UNNAMED_READERPrefs::self()); + QWidget *generalSettingsDlg = new QWidget;
+ Ui_settingsWidget guiBuilder;
+ guiBuilder.setupUi(generalSettingsDlg);
+ dialog->addPage(generalSettingsDlg, i18n("User Interface"), "package_setting");
+ dialog->show();
+}
+
+
void mainWindow::showFullScreen()
{
kDebug(UNNAMED_READER_DEBUG, shell) << "mainWindow::showFullScreen()" << endl;
@@ -201,7 +219,7 @@
void mainWindow::setupActions()
{
kDebug(UNNAMED_READER_DEBUG, shell) << "mainWindow::setupAction()" << endl;
-
+
KStandardAction::open(this, SLOT(open()), actionCollection());
// *** FILE MENU ***
@@ -243,6 +261,8 @@
act = new KAction(i18n("Re-enable all warnings"), actionCollection(), \
"reenablewarnings"); connect(act, SIGNAL(triggered()), this, \
SLOT(reenableAllWarnings()));
+ KStandardAction::preferences(this, SLOT(editSettings()), actionCollection());
+
// *** HELP MENU ***
// Tip of day
KStandardAction::tipOfDay(this, SLOT(showTip()), actionCollection());
--- trunk/playground/graphics/UNNAMED_READER/UNNAMED_READER/mainWindow.h \
#619739:619740 @@ -114,6 +114,9 @@
// Shows the tip of the day
void showTip() {KTipDialog::showTip(this, "UNNAMED_READER/tips", true);}
+ // Shows the preferences dialog
+ void editSettings();
+
// Shows the current document in full screen mode
void showFullScreen();
--- trunk/playground/graphics/UNNAMED_READER/corelibrary/dropObserver.cpp \
#619739:619740 @@ -20,7 +20,6 @@
#include <config.h>
-#include "../UNNAMED_READER/mainWindow.h"
#include "dropObserver.h"
#include "fileFormats.h"
#include "UNNAMED_READER_debug.h"
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic