Commit 0a982319 authored by Jonathan Doman's avatar Jonathan Doman Committed by Albert Astals Cid

Tabbed interface

GUI
BUGS: 155515
REVIEW: 110914
parent 90779f4a
......@@ -703,10 +703,10 @@ void Part::setupViewerActions()
reload->setShortcut( KStandardShortcut::reload() );
m_reload = reload;
m_closeFindBar = new KAction( i18n( "Close &Find Bar" ), ac );
ac->addAction("close_find_bar", m_closeFindBar);
connect(m_closeFindBar, SIGNAL(triggered()), this, SLOT(slotHideFindBar()));
widget()->addAction(m_closeFindBar);
m_closeFindBar = ac->addAction( "close_find_bar", this, SLOT(slotHideFindBar()) );
m_closeFindBar->setText( i18n("Close &Find Bar") );
m_closeFindBar->setShortcut( QKeySequence(Qt::Key_Escape) );
m_closeFindBar->setEnabled( false );
KAction *pageno = new KAction( i18n( "Page Number" ), ac );
pageno->setDefaultWidget( m_pageNumberTool );
......@@ -1226,6 +1226,8 @@ bool Part::openFile()
}
bool canSearch = m_document->supportsSearching();
emit mimeTypeChanged( mime );
// update one-time actions
emit enableCloseAction( ok );
m_find->setEnabled( ok && canSearch );
......@@ -1790,7 +1792,7 @@ void Part::slotShowFindBar()
{
m_findBar->show();
m_findBar->focusAndSetCursor();
m_closeFindBar->setShortcut( QKeySequence( Qt::Key_Escape ) );
m_closeFindBar->setEnabled( true );
}
void Part::slotHideFindBar()
......@@ -1798,7 +1800,7 @@ void Part::slotHideFindBar()
if ( m_findBar->maybeHide() )
{
m_pageView->setFocus();
m_closeFindBar->setShortcut( QKeySequence( /* None */ ) );
m_closeFindBar->setEnabled( false );
}
}
......
......@@ -156,6 +156,7 @@ class OKULAR_PART_EXPORT Part : public KParts::ReadWritePart, public Okular::Doc
void openSourceReference(const QString& absFileName, int line, int column);
void viewerMenuStateChange(bool enabled);
void enableCloseAction(bool enable);
void mimeTypeChanged(KMimeType::Ptr mimeType);
protected:
// reimplemented from KParts::ReadWritePart
......
This diff is collapsed.
......@@ -17,12 +17,15 @@
#define _OKULAR_SHELL_H_
#include <kparts/mainwindow.h>
#include <kmimetype.h>
#include <QtDBus/QtDBus>
class KCmdLineArgs;
class KRecentFilesAction;
class KToggleAction;
class KTabWidget;
class KPluginFactory;
class KDocumentViewer;
class Part;
......@@ -91,6 +94,16 @@ private slots:
void delayedOpen();
void showOpenRecentMenu();
void closeUrl();
void print();
void setPrintEnabled( bool enabled );
void setCloseEnabled( bool enabled );
void setTabIcon( KMimeType::Ptr mimeType );
// Tab event handlers
void setActiveTab( int tab );
void closeTab( int tab );
void activateNextTab();
void activatePrevTab();
signals:
void restoreDocument(const KConfigGroup &group);
......@@ -101,11 +114,13 @@ private:
void setupActions();
void init();
QStringList fileFormats() const;
void openNewTab( const KUrl& url );
void connectPart( QObject* part );
int findTabIndex( QObject* sender );
private:
KCmdLineArgs* m_args;
KParts::ReadWritePart* m_part;
KDocumentViewer* m_doc;
KPluginFactory* m_partFactory;
KRecentFilesAction* m_recent;
QStringList m_fileformats;
bool m_fileformatsscanned;
......@@ -116,6 +131,23 @@ private:
bool m_menuBarWasShown, m_toolBarWasShown;
bool m_unique;
KUrl m_openUrl;
KTabWidget* m_tabWidget;
KToggleAction* m_openInTab;
struct TabState
{
TabState( KParts::ReadWritePart* p )
: part(p),
printEnabled(false),
closeEnabled(false)
{}
KParts::ReadWritePart* part;
bool printEnabled;
bool closeEnabled;
};
QList<TabState> m_tabs;
KAction* m_nextTabAction;
KAction* m_prevTabAction;
#ifdef KActivities_FOUND
KActivities::ResourceInstance* m_activityResource;
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui version="7" name="okular_shell" >
<kpartgui version="8" name="okular_shell" >
<MenuBar>
<Menu name="file" >
<DefineGroup append="open_merge" name="file_open" />
......@@ -12,6 +12,7 @@
<Menu name="settings" >
<DefineGroup append="show_merge" name="show_merge" />
<DefineGroup append="configure_merge" name="configure_merge" />
<Action append="fullscreen_merge" name="open_in_tab" />
</Menu>
<Merge/>
<Menu name="help">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment