summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kpdf/conf/dlggeneral.ui8
-rw-r--r--kpdf/conf/kpdf.kcfg3
-rw-r--r--kpdf/conf/preferencesdialog.cpp30
-rw-r--r--kpdf/conf/preferencesdialog.h4
-rw-r--r--kpdf/part.cpp42
-rw-r--r--kpdf/part.h10
-rw-r--r--kpdf/shell/shell.cpp23
-rw-r--r--kpdf/shell/shell.h3
8 files changed, 92 insertions, 31 deletions
diff --git a/kpdf/conf/dlggeneral.ui b/kpdf/conf/dlggeneral.ui
index 5348111d..7cde356f 100644
--- a/kpdf/conf/dlggeneral.ui
+++ b/kpdf/conf/dlggeneral.ui
@@ -78,6 +78,14 @@
</widget>
<widget class="TQCheckBox">
<property name="name">
+ <cstring>kcfg_TabsHoverCloseButton</cstring>
+ </property>
+ <property name="text">
+ <string>Show &amp;close button on tabs when mouse is hovering over them</string>
+ </property>
+ </widget>
+ <widget class="TQCheckBox">
+ <property name="name">
<cstring>kcfg_ObeyDRM</cstring>
</property>
<property name="text">
diff --git a/kpdf/conf/kpdf.kcfg b/kpdf/conf/kpdf.kcfg
index c9c4f94f..44587903 100644
--- a/kpdf/conf/kpdf.kcfg
+++ b/kpdf/conf/kpdf.kcfg
@@ -53,6 +53,9 @@
<entry key="WatchFile" type="Bool" >
<default>true</default>
</entry>
+ <entry key="TabsHoverCloseButton" type="Bool" >
+ <default>false</default>
+ </entry>
<entry key="ObeyDRM" type="Bool" >
<default>true</default>
</entry>
diff --git a/kpdf/conf/preferencesdialog.cpp b/kpdf/conf/preferencesdialog.cpp
index 3b8de428..814c5301 100644
--- a/kpdf/conf/preferencesdialog.cpp
+++ b/kpdf/conf/preferencesdialog.cpp
@@ -8,6 +8,7 @@
***************************************************************************/
#include <tdelocale.h>
+#include <tqcheckbox.h>
// single config pages
#include "dlggeneral.h"
@@ -19,16 +20,25 @@
#include "preferencesdialog.h"
PreferencesDialog::PreferencesDialog( TQWidget * parent, TDEConfigSkeleton * skeleton )
- : TDEConfigDialog( parent, "preferences", skeleton )
+ : TDEConfigDialog( parent, "preferences", skeleton ),
+ m_shellMode(false)
{
- m_general = new DlgGeneral(0);
- m_performance = new DlgPerformance(0);
- m_accessibility = new DlgAccessibility(0);
- m_presentation = new DlgPresentation(0);
+ m_general = new DlgGeneral(nullptr);
+ m_performance = new DlgPerformance(nullptr);
+ m_accessibility = new DlgAccessibility(nullptr);
+ m_presentation = new DlgPresentation(nullptr);
- addPage( m_general, i18n("General"), "kpdf", i18n("General Options") );
- addPage( m_accessibility, i18n("Accessibility"), "access", i18n("Reading Aids") );
- addPage( m_performance, i18n("Performance"), "launch", i18n("Performance Tuning") );
- addPage( m_presentation, i18n("Presentation"), "application-x-kpresenter",
- i18n("Options for Presentation Mode") );
+ addPage(m_general, i18n("General"), "kpdf", i18n("General Options"));
+ addPage(m_accessibility, i18n("Accessibility"), "access", i18n("Reading Aids"));
+ addPage(m_performance, i18n("Performance"), "launch", i18n("Performance Tuning"));
+ addPage(m_presentation, i18n("Presentation"), "application-x-kpresenter",
+ i18n("Options for Presentation Mode"));
+
+ setShellMode(m_shellMode);
+}
+
+void PreferencesDialog::setShellMode(bool on)
+{
+ m_shellMode = on;
+ m_general->kcfg_TabsHoverCloseButton->setHidden(!m_shellMode);
}
diff --git a/kpdf/conf/preferencesdialog.h b/kpdf/conf/preferencesdialog.h
index bc7b0cbf..c0b2fc53 100644
--- a/kpdf/conf/preferencesdialog.h
+++ b/kpdf/conf/preferencesdialog.h
@@ -27,6 +27,9 @@ class PreferencesDialog : public TDEConfigDialog
public:
PreferencesDialog( TQWidget * parent, TDEConfigSkeleton * config );
+ bool shellMode() { return m_shellMode; }
+ void setShellMode(bool on);
+
protected:
// void updateSettings(); // Called when OK/Apply is pressed.
// void updateWidgets(); // Called upon construction or when Reset is pressed
@@ -39,6 +42,7 @@ class PreferencesDialog : public TDEConfigDialog
DlgPerformance * m_performance;
DlgAccessibility * m_accessibility;
DlgPresentation * m_presentation;
+ bool m_shellMode;
};
#endif
diff --git a/kpdf/part.cpp b/kpdf/part.cpp
index 853fbdb4..09027948 100644
--- a/kpdf/part.cpp
+++ b/kpdf/part.cpp
@@ -121,11 +121,11 @@ Part::Part(TQWidget *parentWidget, const char *widgetName,
{
// connect the started signal to tell the job the mimetypes we like
connect(this, TQ_SIGNAL(started(TDEIO::Job *)), this, TQ_SLOT(setMimeTypes(TDEIO::Job *)));
-
+
// connect the completed signal so we can put the window caption when loading remote files
connect(this, TQ_SIGNAL(completed()), this, TQ_SLOT(emitWindowCaption()));
connect(this, TQ_SIGNAL(canceled(const TQString &)), this, TQ_SLOT(emitWindowCaption()));
-
+
// load catalog for translation
TDEGlobal::locale()->insertCatalogue("kpdf");
@@ -150,7 +150,7 @@ Part::Part(TQWidget *parentWidget, const char *widgetName,
connect( m_document, TQ_SIGNAL( linkEndPresentation() ), this, TQ_SLOT( slotHidePresentation() ) );
connect( m_document, TQ_SIGNAL( openURL(const KURL &) ), this, TQ_SLOT( openURLFromDocument(const KURL &) ) );
connect( m_document, TQ_SIGNAL( close() ), this, TQ_SLOT( close() ) );
-
+
if (parent && parent->metaObject()->slotNames(true).contains("slotQuit()"))
connect( m_document, TQ_SIGNAL( quit() ), parent, TQ_SLOT( slotQuit() ) );
else
@@ -168,7 +168,7 @@ Part::Part(TQWidget *parentWidget, const char *widgetName,
m_splitter = new TQSplitter( parentWidget, widgetName );
m_splitter->setOpaqueResize( true );
setWidget( m_splitter );
-
+
m_showLeftPanel = new TDEToggleAction( i18n( "Show &Navigation Panel"), "show_side_panel", 0, this, TQ_SLOT( slotShowLeftPanel() ), actionCollection(), "show_leftpanel" );
m_showLeftPanel->setCheckedState( i18n( "Hide &Navigation Panel") );
m_showLeftPanel->setShortcut( "CTRL+L" );
@@ -343,6 +343,12 @@ Part::~Part()
delete globalParams;
}
+bool Part::isKPDFShell()
+{
+ return parent() && parent()->parent() &&
+ strcmp(parent()->parent()->name(), "KPDF::Shell") == 0;
+}
+
void Part::notifyViewportChanged( bool /*smoothMove*/ )
{
// update actions if the page is changed
@@ -379,7 +385,7 @@ uint Part::currentPage()
KURL Part::currentDocument()
{
- return m_document->currentDocument();
+ return m_document->currentDocument();
}
//this don't go anywhere but is required by genericfactory.h
@@ -642,7 +648,7 @@ void Part::slotDoFileDirty()
void Part::close()
{
- if (parent() && strcmp(parent()->name(), "KPDF::Shell") == 0)
+ if (isKPDFShell())
{
closeURL();
}
@@ -701,7 +707,7 @@ void Part::saveSplitterSize()
{
KpdfSettings::setSplitterSizes( m_splitter->sizes() );
KpdfSettings::writeConfig();
-}
+}
//BEGIN go to page dialog
class KPDFGotoPageDialog : public KDialogBase
@@ -840,6 +846,12 @@ void Part::slotPreferences()
// keep us informed when the user changes settings
connect( dialog, TQ_SIGNAL( settingsChanged() ), this, TQ_SLOT( slotNewConfig() ) );
+ if (isKPDFShell())
+ {
+ connect(dialog, TQ_SIGNAL( settingsChanged() ),
+ parent()->parent(), TQ_SLOT( reconfigure() ) );
+ }
+ dialog->setShellMode(isKPDFShell());
dialog->show();
}
@@ -849,7 +861,7 @@ void Part::slotNewConfig()
// changed before applying changes.
// Watch File
- bool watchFile = KpdfSettings::watchFile();
+ bool watchFile = KpdfSettings::watchFile();
if ( watchFile && m_watcher->isStopped() )
m_watcher->startScan();
if ( !watchFile && !m_watcher->isStopped() )
@@ -921,7 +933,7 @@ void Part::slotShowMenu(const KPDFPage *page, const TQPoint &point)
TDEActionCollection *ac;
TDEActionPtrList::const_iterator it, end, begin;
TDEActionPtrList actions;
-
+
if (factory())
{
TQPtrList<KXMLGUIClient> clients(factory()->clients());
@@ -942,8 +954,8 @@ void Part::slotShowMenu(const KPDFPage *page, const TQPoint &point)
}
m_actionsSearched = true;
}
-
-
+
+
TDEPopupMenu *popup = new TDEPopupMenu( widget(), "rmb popup" );
if (page)
{
@@ -965,16 +977,16 @@ void Part::slotShowMenu(const KPDFPage *page, const TQPoint &point)
m_popup->insertItem( SmallIcon("document-save"), i18n("Save Image..."), 4 );
m_popup->setItemEnabled( 4, false );
}*/
-
+
if ((m_showMenuBarAction && !m_showMenuBarAction->isChecked()) || (m_showFullScreenAction && m_showFullScreenAction->isChecked()))
{
popup->insertTitle( i18n( "Tools" ) );
if (m_showMenuBarAction && !m_showMenuBarAction->isChecked()) m_showMenuBarAction->plug(popup);
if (m_showFullScreenAction && m_showFullScreenAction->isChecked()) m_showFullScreenAction->plug(popup);
reallyShow = true;
-
+
}
-
+
if (reallyShow)
{
switch ( popup->exec(point) )
@@ -1069,7 +1081,7 @@ void Part::doPrint(KPrinter &printer)
if (!m_document->print(printer))
{
- KMessageBox::error(widget(), i18n("Could not print the document. Please report to bugs.trinitydesktop.org"));
+ KMessageBox::error(widget(), i18n("Could not print the document. Please report to bugs.trinitydesktop.org"));
}
}
diff --git a/kpdf/part.h b/kpdf/part.h
index 7a5b2739..bfa24506 100644
--- a/kpdf/part.h
+++ b/kpdf/part.h
@@ -60,7 +60,7 @@ class BrowserExtension;
class Part : public KParts::ReadOnlyPart, public DocumentObserver, virtual public kpdf_dcop
{
TQ_OBJECT
-
+
public:
// Default constructor
@@ -82,6 +82,8 @@ public:
uint currentPage();
KURL currentDocument();
+ bool isKPDFShell();
+
signals:
void enablePrintAction(bool enable);
@@ -166,10 +168,10 @@ private:
DocumentViewport m_viewportDirty;
bool m_wasPresentationOpen;
int m_dirtyToolboxIndex;
-
+
// Remember the search history
TQStringList m_searchHistory;
-
+
// mimetype got from the job
TQString m_jobMime;
@@ -199,7 +201,7 @@ private:
class BrowserExtension : public KParts::BrowserExtension
{
TQ_OBJECT
-
+
public:
BrowserExtension(Part*);
diff --git a/kpdf/shell/shell.cpp b/kpdf/shell/shell.cpp
index e18d4bba..f2962be0 100644
--- a/kpdf/shell/shell.cpp
+++ b/kpdf/shell/shell.cpp
@@ -24,6 +24,7 @@
#include <ktabwidget.h>
#include <tqptrlist.h>
#include <tdeaction.h>
+#include <tdeconfig.h>
#include <tdeapplication.h>
#include <kedittoolbar.h>
#include <tdefiledialog.h>
@@ -87,9 +88,11 @@ void Shell::init()
m_tabs = new KTabWidget(this);
connect(m_tabs, TQ_SIGNAL(contextMenu(const TQPoint &)),
- this, TQ_SLOT(slotTabContextMenu(const TQPoint &)));
+ TQ_SLOT(slotTabContextMenu(const TQPoint &)));
connect(m_tabs, TQ_SIGNAL(contextMenu(TQWidget*, const TQPoint &)),
TQ_SLOT(slotTabContextMenu(TQWidget*, const TQPoint &)));
+ connect(m_tabs, TQ_SIGNAL(closeRequest(TQWidget*)),
+ TQ_SLOT(slotCloseTabRequest(TQWidget*)));
m_manager = new KParts::PartManager(this, "kpdf part manager");
connect(m_manager, TQ_SIGNAL(activePartChanged(KParts::Part*)),
@@ -117,6 +120,8 @@ void Shell::init()
{
TQTimer::singleShot(0, this, TQ_SLOT(delayedOpen()));
}
+
+ reconfigure();
}
void Shell::delayedOpen()
@@ -132,6 +137,13 @@ Shell::~Shell()
}
}
+void Shell::reconfigure()
+{
+ TDEConfig cfg("kpdfpartrc");
+ cfg.setGroup("General");
+ m_tabs->setHoverCloseButton(cfg.readBoolEntry("TabsHoverCloseButton", false));
+}
+
void Shell::openURL( const KURL & url )
{
// if the current part has no url, reuse part
@@ -339,7 +351,7 @@ KParts::ReadOnlyPart* Shell::createTab()
(KParts::ReadOnlyPart*)m_factory->createPart(m_tabs, "kpdf_part",
m_tabs, nullptr,
"KParts::ReadOnlyPart");
- m_tabs->addTab(part->widget(), i18n("No file"));
+ m_tabs->addTab(part->widget(), SmallIcon("application-pdf"), i18n("No file"));
connect(this, TQ_SIGNAL(restoreDocument(TDEConfig*)),
part, TQ_SLOT(restoreDocument(TDEConfig*)));
@@ -628,4 +640,11 @@ void Shell::slotSetTabCaption(const TQString &caption)
}
}
+void Shell::slotCloseTabRequest(TQWidget *w)
+{
+ m_workingTab = m_tabs->indexOf(w);
+ if (m_workingTab == -1) return;
+ removeTab();
+}
+
#include "shell.moc"
diff --git a/kpdf/shell/shell.h b/kpdf/shell/shell.h
index 6b4eb48b..e36ddc78 100644
--- a/kpdf/shell/shell.h
+++ b/kpdf/shell/shell.h
@@ -92,6 +92,8 @@ namespace KPDF
void setFullScreen( bool );
public slots:
+ void reconfigure();
+
void openURL(const KURL & url);
void slotAddTab();
void slotRemoveTab();
@@ -106,6 +108,7 @@ namespace KPDF
void slotShowMenubar();
void delayedOpen();
+ void slotCloseTabRequest(TQWidget *w);
void slotChangeTab(KParts::Part *part);
void slotTabContextMenu(const TQPoint &pos);
void slotTabContextMenu(TQWidget *w, const TQPoint &pos);