Move the open new files in tabs setting to configure dialog

Also make it non enabled by default for now

GUI
BUGS: 155515
remotes/origin/KDE/4.13
Albert Astals Cid 12 years ago
parent 0a982319f4
commit 7681cdf004
  1. 1
      conf/dlggeneral.cpp
  2. 7
      conf/dlggeneralbase.ui
  3. 3
      conf/okular.kcfg
  4. 4
      interfaces/viewerinterface.h
  5. 5
      part.cpp
  6. 1
      part.h
  7. 19
      shell/shell.cpp
  8. 3
      shell/shell.rc

@ -27,6 +27,7 @@ DlgGeneral::DlgGeneral( QWidget * parent, Okular::EmbedMode embedMode )
m_dlg->kcfg_DisplayDocumentTitle->setVisible( false ); m_dlg->kcfg_DisplayDocumentTitle->setVisible( false );
m_dlg->kcfg_WatchFile->setVisible( false ); m_dlg->kcfg_WatchFile->setVisible( false );
} }
m_dlg->kcfg_ShellOpenFileInTabs->setVisible( embedMode == Okular::NativeShellMode );
} }
DlgGeneral::~DlgGeneral() DlgGeneral::~DlgGeneral()

@ -187,6 +187,13 @@
<property name="margin"> <property name="margin">
<number>0</number> <number>0</number>
</property> </property>
<item>
<widget class="QCheckBox" name="kcfg_ShellOpenFileInTabs">
<property name="text">
<string>Open new files in &amp;tabs</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="kcfg_ObeyDRM"> <widget class="QCheckBox" name="kcfg_ObeyDRM">
<property name="text"> <property name="text">

@ -79,6 +79,9 @@
</entry> </entry>
</group> </group>
<group name="General" > <group name="General" >
<entry key="ShellOpenFileInTabs" type="Bool" >
<default>false</default>
</entry>
<entry key="ShowOSD" type="Bool" > <entry key="ShowOSD" type="Bool" >
<default>true</default> <default>true</default>
</entry> </entry>

@ -64,6 +64,10 @@ class ViewerInterface
*/ */
virtual void setWatchFileModeEnabled(bool b) = 0; virtual void setWatchFileModeEnabled(bool b) = 0;
/**
* Should the shell that supports tabs pen new files in tabs?
*/
virtual bool openNewFilesInTabs() const = 0;
// SIGNALS // SIGNALS
/** /**

@ -942,6 +942,11 @@ void Part::setShowSourceLocationsGraphically(bool show)
m_pageView->setShowSourceLocationsGraphically(show); m_pageView->setShowSourceLocationsGraphically(show);
} }
bool Part::openNewFilesInTabs() const
{
return Okular::Settings::self()->shellOpenFileInTabs();
}
void Part::slotHandleActivatedSourceReference(const QString& absFileName, int line, int col, bool *handled) void Part::slotHandleActivatedSourceReference(const QString& absFileName, int line, int col, bool *handled)
{ {
emit openSourceReference( absFileName, line, col ); emit openSourceReference( absFileName, line, col );

@ -132,6 +132,7 @@ class OKULAR_PART_EXPORT Part : public KParts::ReadWritePart, public Okular::Doc
void setWatchFileModeEnabled(bool enable); void setWatchFileModeEnabled(bool enable);
bool areSourceLocationsShownGraphically() const; bool areSourceLocationsShownGraphically() const;
void setShowSourceLocationsGraphically(bool show); void setShowSourceLocationsGraphically(bool show);
bool openNewFilesInTabs() const;
public slots: // dbus public slots: // dbus
Q_SCRIPTABLE Q_NOREPLY void goToPage(uint page); Q_SCRIPTABLE Q_NOREPLY void goToPage(uint page);

@ -52,6 +52,7 @@
// local includes // local includes
#include "kdocumentviewer.h" #include "kdocumentviewer.h"
#include "../interfaces/viewerinterface.h"
#include "shellutils.h" #include "shellutils.h"
static const char *shouldShowMenuBarComingFromFullScreen = "shouldShowMenuBarComingFromFullScreen"; static const char *shouldShowMenuBarComingFromFullScreen = "shouldShowMenuBarComingFromFullScreen";
@ -174,7 +175,8 @@ void Shell::openUrl( const KUrl & url )
const int activeTab = m_tabWidget->currentIndex(); const int activeTab = m_tabWidget->currentIndex();
if ( activeTab < m_tabs.size() ) if ( activeTab < m_tabs.size() )
{ {
if( !m_tabs[activeTab].part->url().isEmpty() ) KParts::ReadWritePart* const activePart = m_tabs[activeTab].part;
if( !activePart->url().isEmpty() )
{ {
if( m_unique ) if( m_unique )
{ {
@ -182,7 +184,7 @@ void Shell::openUrl( const KUrl & url )
} }
else else
{ {
if( m_openInTab->isChecked() ) if( dynamic_cast<Okular::ViewerInterface *>(activePart)->openNewFilesInTabs() )
{ {
openNewTab( url ); openNewTab( url );
setActiveTab( m_tabs.size()-1 ); setActiveTab( m_tabs.size()-1 );
@ -197,16 +199,15 @@ void Shell::openUrl( const KUrl & url )
} }
else else
{ {
KParts::ReadWritePart* const emptyPart = m_tabs[activeTab].part;
m_tabWidget->setTabText( activeTab, url.fileName() ); m_tabWidget->setTabText( activeTab, url.fileName() );
if ( m_args ){ if ( m_args ){
KDocumentViewer* const doc = qobject_cast<KDocumentViewer*>(emptyPart); KDocumentViewer* const doc = qobject_cast<KDocumentViewer*>(activePart);
if ( doc && m_args->isSet( "presentation" ) ) if ( doc && m_args->isSet( "presentation" ) )
doc->startPresentation(); doc->startPresentation();
if ( m_args->isSet( "print" ) ) if ( m_args->isSet( "print" ) )
QMetaObject::invokeMethod( emptyPart, "enableStartWithPrint" ); QMetaObject::invokeMethod( activePart, "enableStartWithPrint" );
} }
bool openOk = emptyPart->openUrl( url ); bool openOk = activePart->openUrl( url );
const bool isstdin = url.fileName( KUrl::ObeyTrailingSlash ) == QLatin1String( "-" ); const bool isstdin = url.fileName( KUrl::ObeyTrailingSlash ) == QLatin1String( "-" );
if ( !isstdin ) if ( !isstdin )
{ {
@ -246,8 +247,6 @@ void Shell::readSettings()
m_menuBarWasShown = group.readEntry( shouldShowMenuBarComingFromFullScreen, true ); m_menuBarWasShown = group.readEntry( shouldShowMenuBarComingFromFullScreen, true );
m_toolBarWasShown = group.readEntry( shouldShowToolBarComingFromFullScreen, true ); m_toolBarWasShown = group.readEntry( shouldShowToolBarComingFromFullScreen, true );
} }
m_openInTab->setChecked( group.readEntry("OpenInTab", true) );
} }
void Shell::writeSettings() void Shell::writeSettings()
@ -260,7 +259,6 @@ void Shell::writeSettings()
group.writeEntry( shouldShowMenuBarComingFromFullScreen, m_menuBarWasShown ); group.writeEntry( shouldShowMenuBarComingFromFullScreen, m_menuBarWasShown );
group.writeEntry( shouldShowToolBarComingFromFullScreen, m_toolBarWasShown ); group.writeEntry( shouldShowToolBarComingFromFullScreen, m_toolBarWasShown );
} }
group.writeEntry( "OpenInTab", m_openInTab->isChecked() );
KGlobal::config()->sync(); KGlobal::config()->sync();
} }
@ -294,9 +292,6 @@ void Shell::setupActions()
m_prevTabAction->setShortcut( KStandardShortcut::tabPrev() ); m_prevTabAction->setShortcut( KStandardShortcut::tabPrev() );
m_prevTabAction->setEnabled( false ); m_prevTabAction->setEnabled( false );
connect( m_prevTabAction, SIGNAL(triggered()), this, SLOT(activatePrevTab()) ); connect( m_prevTabAction, SIGNAL(triggered()), this, SLOT(activatePrevTab()) );
m_openInTab = actionCollection()->add<KToggleAction>("open_in_tab");
m_openInTab->setText( i18n("Open Documents in New Tab") );
} }
void Shell::saveProperties(KConfigGroup &group) void Shell::saveProperties(KConfigGroup &group)

@ -1,5 +1,5 @@
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui version="8" name="okular_shell" > <kpartgui version="7" name="okular_shell" >
<MenuBar> <MenuBar>
<Menu name="file" > <Menu name="file" >
<DefineGroup append="open_merge" name="file_open" /> <DefineGroup append="open_merge" name="file_open" />
@ -12,7 +12,6 @@
<Menu name="settings" > <Menu name="settings" >
<DefineGroup append="show_merge" name="show_merge" /> <DefineGroup append="show_merge" name="show_merge" />
<DefineGroup append="configure_merge" name="configure_merge" /> <DefineGroup append="configure_merge" name="configure_merge" />
<Action append="fullscreen_merge" name="open_in_tab" />
</Menu> </Menu>
<Merge/> <Merge/>
<Menu name="help"> <Menu name="help">

Loading…
Cancel
Save