Pass the saveas menu entry from the shell to the part so you can use it while embedded in konqueror

svn path=/trunk/kdegraphics/kpdf/; revision=342226
remotes/origin/kpdf-experiments
Albert Astals Cid 22 years ago
parent f603d008d0
commit eac9aad8eb
  1. 19
      kpdf/kpdf_part.cpp
  2. 1
      kpdf/kpdf_part.h
  3. 1
      kpdf/kpdf_part.rc
  4. 17
      kpdf/kpdf_shell.cpp
  5. 1
      kpdf/kpdf_shell.h

@ -39,8 +39,10 @@
#include <kparts/genericfactory.h>
#include <kurldrag.h>
#include <kinputdialog.h>
#include <kfiledialog.h>
#include <kfinddialog.h>
#include <kmessagebox.h>
#include <kio/netaccess.h>
#include "kpdf_error.h"
#include "part.h"
@ -101,6 +103,7 @@ Part::Part(QWidget *parentWidget, const char *widgetName,
SLOT( showMarkList( bool ) ) );
// create our actions
KStdAction::saveAs(this, SLOT(fileSaveAs()), actionCollection(), "save");
m_find = KStdAction::find(this, SLOT(find()),
actionCollection(), "find");
m_find->setEnabled(false);
@ -412,6 +415,22 @@ void Part::nextThumbnail()
m_nextThumbnail++;
if (m_nextThumbnail <= m_doc->getNumPages())
QTimer::singleShot(10, this, SLOT(nextThumbnail()));
}
void
Part::fileSaveAs()
{
KURL saveURL = KFileDialog::getSaveURL(
url().isLocalFile()
? url().url()
: url().fileName(),
QString::null,
widget(),
QString::null );
if( !KIO::NetAccess::upload( url().path(),
saveURL, static_cast<QWidget*>( 0 ) ) )
; // TODO: Proper error dialog
}
void

@ -162,6 +162,7 @@ namespace KPDF
void redrawPage();
void pageClicked ( int );
void nextThumbnail();
void fileSaveAs();
};
class BrowserExtension : public KParts::BrowserExtension

@ -2,6 +2,7 @@
<kpartgui name="kpdf_part" version="13">
<MenuBar>
<Menu name="file"><text>&amp;File</text>
<Action name="save" group="file_save"/>
<Action name="file_print" group="file_print"/>
<Action name="file_print_preview" group="file_print"/>
</Menu>

@ -122,7 +122,6 @@ Shell::setupActions()
KStdAction::open(this, SLOT(fileOpen()), actionCollection());
recent = KStdAction::openRecent( this, SLOT( openURL( const KURL& ) ),
actionCollection() );
KStdAction::saveAs(this, SLOT(fileSaveAs()), actionCollection());
KStdAction::print(m_part, SLOT(print()), actionCollection());
KStdAction::quit(this, SLOT(slotQuit()), actionCollection());
@ -175,22 +174,6 @@ Shell::fileOpen()
if (!url.isEmpty())
openURL(url);
}
void
Shell::fileSaveAs()
{
KURL saveURL = KFileDialog::getSaveURL(
m_part->url().isLocalFile()
? m_part->url().url()
: m_part->url().fileName(),
QString::null,
m_part->widget(),
QString::null );
if( !KIO::NetAccess::upload( m_part->url().path(),
saveURL, static_cast<QWidget*>( 0 ) ) )
; // TODO: Proper error dialog
}
void

@ -70,7 +70,6 @@ namespace KPDF
private slots:
void fileOpen();
void fileSaveAs();
void slotQuit();

Loading…
Cancel
Save