22 #include "katemainwindow.h"
23 #include "katemainwindow.moc"
25 #include "kateconfigdialog.h"
26 #include "kateconsole.h"
27 #include "katedocmanager.h"
28 #include "katepluginmanager.h"
29 #include "kateconfigplugindialogpage.h"
30 #include "kateviewmanager.h"
32 #include "katefileselector.h"
33 #include "katefilelist.h"
34 #include "kategrepdialog.h"
35 #include "katemailfilesdialog.h"
36 #include "katemainwindowiface.h"
37 #include "kateexternaltools.h"
38 #include "katesavemodifieddialog.h"
39 #include "katemwmodonhddialog.h"
40 #include "katesession.h"
41 #include "katetabwidget.h"
43 #include "../interfaces/mainwindow.h"
44 #include "../interfaces/toolviewmanager.h"
46 #include <dcopclient.h>
47 #include <kinstance.h>
48 #include <tdeaboutdata.h>
49 #include <tdeaction.h>
50 #include <tdecmdlineargs.h>
52 #include <kdialogbase.h>
53 #include <tdediroperator.h>
54 #include <kdockwidget.h>
55 #include <kedittoolbar.h>
56 #include <tdefiledialog.h>
57 #include <kglobalaccel.h>
58 #include <tdeglobal.h>
59 #include <tdeglobalsettings.h>
60 #include <kiconloader.h>
61 #include <kkeydialog.h>
62 #include <tdelocale.h>
63 #include <tdemessagebox.h>
64 #include <kmimetype.h>
65 #include <kopenwith.h>
66 #include <tdepopupmenu.h>
67 #include <ksimpleconfig.h>
68 #include <kstatusbar.h>
69 #include <kstdaction.h>
70 #include <kstandarddirs.h>
72 #include <kuniqueapplication.h>
74 #include <kdesktopfile.h>
75 #include <khelpmenu.h>
76 #include <tdemultitabbar.h>
78 #include <tdemenubar.h>
79 #include <kstringhandler.h>
81 #include <tqptrvector.h>
87 uint KateMainWindow::uniqueID = 1;
89 KateMainWindow::KateMainWindow (TDEConfig *sconfig,
const TQString &sgroup)
90 : KateMDI::MainWindow (0,(TQString(TQString(
"__KateMainWindow#%1").arg(uniqueID))).latin1())
102 if (!initialGeometrySet())
104 int scnum = TQApplication::desktop()->screenNumber(parentWidget());
105 TQRect desk = TQApplication::desktop()->screenGeometry(scnum);
112 sconfig->setGroup (sgroup);
113 size.setWidth (sconfig->readNumEntry( TQString::fromLatin1(
"Width %1").arg(desk.width()), 0 ));
114 size.setHeight (sconfig->readNumEntry( TQString::fromLatin1(
"Height %1").arg(desk.height()), 0 ));
134 size.setWidth (
KateApp::self()->config()->readNumEntry( TQString::fromLatin1(
"Width %1").arg(desk.width()), 0 ));
135 size.setHeight (
KateApp::self()->config()->readNumEntry( TQString::fromLatin1(
"Height %1").arg(desk.height()), 0 ));
138 size = TQSize (kMin (700, desk.width()), kMin(480, desk.height()));
146 startRestore (sconfig, sgroup);
148 m_mainWindow =
new Kate::MainWindow (
this);
151 m_dcop =
new KateMainWindowDCOPIface (
this);
159 setStandardToolBarMenuEnabled(
true );
160 setXMLFile(
"kateui.rc" );
161 createShellGUI (
true );
163 KatePluginManager::self()->enableAllPluginsGUI (
this);
166 Kate::Document::registerCommand(KateExternalToolsCommand::self());
169 documentMenu = (TQPopupMenu*)factory()->container(
"documents",
this);
170 connect(documentMenu, TQT_SIGNAL(aboutToShow()),
this, TQT_SLOT(documentMenuAboutToShow()));
173 for (uint i = 0; i < KateDocManager::self()->documents(); i++)
174 slotDocumentCreated (KateDocManager::self()->document(i));
176 connect(KateDocManager::self(),TQT_SIGNAL(documentCreated(Kate::Document *)),
this,TQT_SLOT(slotDocumentCreated(Kate::Document *)));
181 m_viewManager->restoreViewConfiguration (sconfig, sgroup);
185 setAcceptDrops(
true);
188 KateMainWindow::~KateMainWindow()
199 KatePluginManager::self()->disableAllPluginsGUI (
this);
204 void KateMainWindow::setupMainWindow ()
206 setToolViewStyle( KMultiTabBar::KDEV3ICON );
208 m_tabWidget =
new KateTabWidget (centralWidget());
210 m_viewManager =
new KateViewManager (
this);
212 KateMDI::ToolView *ft = createToolView(
"kate_filelist", KMultiTabBar::Left, SmallIcon(
"application-vnd.tde.tdemultiple"), i18n(
"Documents"));
213 filelist =
new KateFileList (
this, m_viewManager, ft,
"filelist");
216 KateMDI::ToolView *t = createToolView(
"kate_fileselector", KMultiTabBar::Left, SmallIcon(
"document-open"), i18n(
"Filesystem Browser"));
217 fileselector =
new KateFileSelector(
this, m_viewManager, t,
"operator");
218 connect(fileselector->dirOperator(),TQT_SIGNAL(fileSelected(
const KFileItem*)),
this,TQT_SLOT(fileSelected(
const KFileItem*)));
223 t = createToolView(
"kate_greptool", KMultiTabBar::Bottom, SmallIcon(
"filefind"), i18n(
"Find in Files") );
224 greptool =
new GrepTool( t,
"greptool" );
225 connect(greptool, TQT_SIGNAL(itemSelected(
const TQString &,
int)),
this, TQT_SLOT(slotGrepToolItemSelected(
const TQString &,
int)));
226 connect(t,TQT_SIGNAL(visibleChanged(
bool)),
this, TQT_SLOT(updateGrepDir (
bool)));
230 t = createToolView(
"kate_console", KMultiTabBar::Bottom, SmallIcon(
"konsole"), i18n(
"Terminal"));
238 void KateMainWindow::setupActions()
242 KStdAction::openNew( TQT_TQOBJECT(m_viewManager), TQT_SLOT( slotDocumentNew() ), actionCollection(),
"file_new" )->setWhatsThis(i18n(
"Create a new document"));
243 KStdAction::open( TQT_TQOBJECT(m_viewManager), TQT_SLOT( slotDocumentOpen() ), actionCollection(),
"file_open" )->setWhatsThis(i18n(
"Open an existing document for editing"));
245 fileOpenRecent = KStdAction::openRecent (TQT_TQOBJECT(m_viewManager), TQT_SLOT(openURL (
const KURL&)), actionCollection());
246 fileOpenRecent->setWhatsThis(i18n(
"This lists files which you have opened recently, and allows you to easily open them again."));
248 a=
new TDEAction( i18n(
"Save A&ll"),
"save_all", CTRL+Key_L, KateDocManager::self(), TQT_SLOT( saveAll() ), actionCollection(),
"file_save_all" );
249 a->setWhatsThis(i18n(
"Save all open, modified documents to disk."));
251 KStdAction::close( TQT_TQOBJECT(m_viewManager), TQT_SLOT( slotDocumentClose() ), actionCollection(),
"file_close" )->setWhatsThis(i18n(
"Close the current document."));
253 a=
new TDEAction( i18n(
"Clos&e All" ), 0, TQT_TQOBJECT(
this), TQT_SLOT( slotDocumentCloseAll() ), actionCollection(),
"file_close_all" );
254 a->setWhatsThis(i18n(
"Close all open documents."));
256 KStdAction::mail( TQT_TQOBJECT(
this), TQT_SLOT(slotMail()), actionCollection() )->setWhatsThis(i18n(
"Send one or more of the open documents as email attachments."));
258 KStdAction::quit( TQT_TQOBJECT(
this), TQT_SLOT( slotFileQuit() ), actionCollection(),
"file_quit" )->setWhatsThis(i18n(
"Close this window"));
260 a=
new TDEAction(i18n(
"&New Window"),
"window-new", 0, TQT_TQOBJECT(
this), TQT_SLOT(newWindow()), actionCollection(),
"view_new_view");
261 a->setWhatsThis(i18n(
"Create a new Kate view (a new window with the same document list)."));
266 externalTools->setWhatsThis( i18n(
"Launch external helper applications") );
269 TDEToggleAction* showFullScreenAction = KStdAction::fullScreen( 0, 0, actionCollection(),
this);
270 connect( showFullScreenAction,TQT_SIGNAL(toggled(
bool)),
this,TQT_SLOT(slotFullScreen(
bool)));
272 documentOpenWith =
new TDEActionMenu(i18n(
"Open W&ith"), actionCollection(),
"file_open_with");
273 documentOpenWith->setWhatsThis(i18n(
"Open the current document using another application registered for its file type, or an application of your choice."));
274 connect(documentOpenWith->popupMenu(), TQT_SIGNAL(aboutToShow()),
this, TQT_SLOT(mSlotFixOpenWithMenu()));
275 connect(documentOpenWith->popupMenu(), TQT_SIGNAL(activated(
int)),
this, TQT_SLOT(slotOpenWithMenuAction(
int)));
277 a=KStdAction::keyBindings(TQT_TQOBJECT(
this), TQT_SLOT(editKeys()), actionCollection());
278 a->setWhatsThis(i18n(
"Configure the application's keyboard shortcut assignments."));
280 a=KStdAction::configureToolbars(TQT_TQOBJECT(
this), TQT_SLOT(slotEditToolbars()), actionCollection());
281 a->setWhatsThis(i18n(
"Configure which items should appear in the toolbar(s)."));
283 TDEAction* settingsConfigure = KStdAction::preferences(TQT_TQOBJECT(
this), TQT_SLOT(slotConfigure()), actionCollection(),
"settings_configure");
284 settingsConfigure->setWhatsThis(i18n(
"Configure various aspects of this application and the editing component."));
288 new TDEAction(i18n(
"&Pipe to Console"),
"pipe", 0, TQT_TQOBJECT(console), TQT_SLOT(slotPipeToConsole()), actionCollection(),
"tools_pipe_to_terminal");
291 KStdAction::tipOfDay( TQT_TQOBJECT(
this), TQT_SLOT( tipOfTheDay() ), actionCollection() )->setWhatsThis(i18n(
"This shows useful tips on the use of this application."));
293 if (KatePluginManager::self()->pluginList().count() > 0)
295 a=
new TDEAction(i18n(
"&Plugins Handbook"), 0, TQT_TQOBJECT(
this), TQT_SLOT(pluginHelp()), actionCollection(),
"help_plugins_contents");
296 a->setWhatsThis(i18n(
"This shows help files for various available plugins."));
299 connect(m_viewManager,TQT_SIGNAL(viewChanged()),TQT_TQOBJECT(
this),TQT_SLOT(slotWindowActivated()));
300 connect(m_viewManager,TQT_SIGNAL(viewChanged()),TQT_TQOBJECT(
this),TQT_SLOT(slotUpdateOpenWith()));
302 slotWindowActivated ();
305 new TDEAction(i18n(
"Menu entry Session->New",
"&New"),
"document-new", 0, TQT_TQOBJECT(KateSessionManager::self()), TQT_SLOT(sessionNew()), actionCollection(),
"sessions_new");
306 new TDEAction(i18n(
"&Open..."),
"document-open", 0, TQT_TQOBJECT(KateSessionManager::self()), TQT_SLOT(sessionOpen()), actionCollection(),
"sessions_open");
307 new TDEAction(i18n(
"&Save"),
"document-save", 0, TQT_TQOBJECT(KateSessionManager::self()), TQT_SLOT(sessionSave()), actionCollection(),
"sessions_save");
308 new TDEAction(i18n(
"Save &As..."),
"document-save-as", 0, TQT_TQOBJECT(KateSessionManager::self()), TQT_SLOT(sessionSaveAs()), actionCollection(),
"sessions_save_as");
309 new TDEAction(i18n(
"&Manage..."),
"view_choose", 0, TQT_TQOBJECT(KateSessionManager::self()), TQT_SLOT(sessionManage()), actionCollection(),
"sessions_manage");
312 new KateSessionsAction (i18n(
"&Quick Open"), actionCollection(),
"sessions_list");
315 KateTabWidget *KateMainWindow::tabWidget ()
320 void KateMainWindow::slotDocumentCloseAll() {
321 if (queryClose_internal())
322 KateDocManager::self()->closeAllDocuments(
false);
325 bool KateMainWindow::queryClose_internal() {
326 uint documentCount=KateDocManager::self()->documents();
328 if ( ! showModOnDiskPrompt() )
331 TQPtrList<Kate::Document> modifiedDocuments=KateDocManager::self()->modifiedDocumentList();
332 bool shutdown=(modifiedDocuments.count()==0);
335 shutdown=KateSaveModifiedDialog::queryClose(
this,modifiedDocuments);
338 if ( KateDocManager::self()->documents() > documentCount ) {
339 KMessageBox::information (
this,
340 i18n (
"New file opened while trying to close Kate, closing aborted."),
341 i18n (
"Closing Aborted"));
351 bool KateMainWindow::queryClose()
357 return queryClose_internal ();
367 if ( queryClose_internal () )
380 void KateMainWindow::newWindow ()
385 void KateMainWindow::slotEditToolbars()
387 saveMainWindowSettings(
KateApp::self()->config(),
"MainWindow" );
388 KEditToolbar dlg( factory() );
389 connect( &dlg, TQT_SIGNAL(newToolbarConfig()),
this, TQT_SLOT(slotNewToolbarConfig()) );
393 void KateMainWindow::slotNewToolbarConfig()
395 applyMainWindowSettings(
KateApp::self()->config(),
"MainWindow" );
398 void KateMainWindow::slotFileQuit()
403 void KateMainWindow::readOptions ()
407 config->setGroup(
"General");
408 syncKonsole = config->readBoolEntry(
"Sync Konsole",
true);
409 useInstance = config->readBoolEntry(
"UseInstance",
false);
410 modNotification = config->readBoolEntry(
"Modified Notification",
false);
411 KateDocManager::self()->setSaveMetaInfos(config->readBoolEntry(
"Save Meta Infos",
true));
412 KateDocManager::self()->setDaysMetaInfos(config->readNumEntry(
"Days Meta Infos", 30));
414 m_viewManager->setShowFullPath(config->readBoolEntry(
"Show Full Path in Title",
false));
416 fileOpenRecent->setMaxItems( config->readNumEntry(
"Number of recent files", fileOpenRecent->maxItems() ) );
417 fileOpenRecent->loadEntries(config,
"Recent Files");
419 fileselector->readConfig(config,
"fileselector");
422 void KateMainWindow::saveOptions ()
425 config->setGroup(
"General");
428 config->writeEntry(
"Show Console", console->isVisible());
430 config->writeEntry(
"Show Console",
false);
432 config->writeEntry(
"Save Meta Infos", KateDocManager::self()->getSaveMetaInfos());
433 config->writeEntry(
"Days Meta Infos", KateDocManager::self()->getDaysMetaInfos());
434 config->writeEntry(
"Show Full Path in Title", m_viewManager->getShowFullPath());
435 config->writeEntry(
"Sync Konsole", syncKonsole);
436 config->writeEntry(
"UseInstance", useInstance);
438 fileOpenRecent->saveEntries(config,
"Recent Files");
439 fileselector->writeConfig(config,
"fileselector");
440 filelist->writeConfig(config,
"Filelist");
445 void KateMainWindow::slotWindowActivated ()
447 if (m_viewManager->activeView())
449 if (console && syncKonsole)
451 static TQString path;
452 TQString newPath = m_viewManager->activeView()->getDoc()->url().directory();
454 if ( newPath != path )
457 console->cd (KURL( path ));
461 updateCaption (m_viewManager->activeView()->getDoc());
465 centralWidget()->setFocusProxy (m_viewManager->activeView());
468 void KateMainWindow::slotUpdateOpenWith()
470 if (m_viewManager->activeView())
471 documentOpenWith->setEnabled(!m_viewManager->activeView()->document()->url().isEmpty());
473 documentOpenWith->setEnabled(
false);
476 void KateMainWindow::documentMenuAboutToShow()
479 while (documentMenu->count() > 3)
480 documentMenu->removeItemAt (3);
482 TQListViewItem * item = filelist->firstChild();
485 TQString name = KStringHandler::rsqueeze( ((KateFileListItem *)item)->document()->docName(), 150 );
486 Kate::Document* doc = ((KateFileListItem *)item)->document();
487 documentMenu->insertItem (
488 doc->isModified() ? i18n(
"'document name [*]', [*] means modified",
"%1 [*]").arg(name) : name,
489 m_viewManager, TQT_SLOT (activateView (
int)), 0,
490 ((KateFileListItem *)item)->documentNumber () );
492 item = item->nextSibling();
494 if (m_viewManager->activeView())
495 documentMenu->setItemChecked ( m_viewManager->activeView()->getDoc()->documentNumber(),
true);
498 void KateMainWindow::slotGrepToolItemSelected(
const TQString &filename,
int linenumber)
501 fileURL.setPath( filename );
502 m_viewManager->openURL( fileURL );
503 if ( m_viewManager->activeView() == 0 )
return;
504 m_viewManager->activeView()->gotoLineNumber( linenumber );
509 void KateMainWindow::dragEnterEvent( TQDragEnterEvent *event )
511 event->accept(KURLDrag::canDecode(event));
514 void KateMainWindow::dropEvent( TQDropEvent *event )
516 slotDropEvent(event);
519 void KateMainWindow::slotDropEvent( TQDropEvent * event )
522 if (!KURLDrag::decode(event, textlist))
return;
524 for (KURL::List::Iterator i=textlist.begin(); i != textlist.end(); ++i)
526 m_viewManager->openURL (*i);
530 void KateMainWindow::editKeys()
532 KKeyDialog dlg (
false,
this );
534 TQPtrList<KXMLGUIClient> clients = guiFactory()->clients();
536 for( TQPtrListIterator<KXMLGUIClient> it( clients ); it.current(); ++it )
537 dlg.insert ( (*it)->actionCollection(), (*it)->instance()->aboutData()->programName() );
539 dlg.insert( externalTools->actionCollection(), i18n(
"External Tools") );
543 TQPtrList<Kate::Document> l=KateDocManager::self()->documentList();
544 for (uint i=0;i<l.count();i++) {
546 l.at(i)->reloadXML();
547 TQPtrList<class KTextEditor::View> l1=l.at(i)->views ();
548 for (uint i1=0;i1<l1.count();i1++) {
549 l1.at(i1)->reloadXML();
554 externalTools->actionCollection()->writeShortcutSettings(
"Shortcuts",
new TDEConfig(
"externaltools",
false,
false,
"appdata") );
557 void KateMainWindow::openURL (
const TQString &name)
559 m_viewManager->openURL (KURL(name));
562 void KateMainWindow::slotConfigure()
564 if (!m_viewManager->activeView())
567 KateConfigDialog* dlg =
new KateConfigDialog (
this, m_viewManager->activeView());
573 KURL KateMainWindow::activeDocumentUrl()
577 Kate::View *v = m_viewManager->activeView();
579 return v->getDoc()->url();
583 void KateMainWindow::fileSelected(
const KFileItem * )
585 const KFileItemList *list=fileselector->dirOperator()->selectedItems();
587 for (KFileItemListIterator it(*list); (tmp = it.current()); ++it)
589 m_viewManager->openURL(tmp->url());
590 fileselector->dirOperator()->view()->setSelected(tmp,
false);
595 void KateMainWindow::mSlotFixOpenWithMenu()
598 documentOpenWith->popupMenu()->clear();
600 KMimeType::Ptr mime = KMimeType::findByURL( m_viewManager->activeView()->getDoc()->url() );
603 TDETrader::OfferList offers = TDETrader::self()->query(mime->name(),
"Type == 'Application'");
605 for(TDETrader::OfferList::Iterator it = offers.begin(); it != offers.end(); ++it) {
606 if ((*it)->name() ==
"Kate")
continue;
607 documentOpenWith->popupMenu()->insertItem( SmallIcon( (*it)->icon() ), (*it)->name() );
610 documentOpenWith->popupMenu()->insertItem(i18n(
"&Other..."));
613 void KateMainWindow::slotOpenWithMenuAction(
int idx)
616 list.append( m_viewManager->activeView()->getDoc()->url() );
617 TQString appname = documentOpenWith->popupMenu()->text(idx);
619 appname = appname.remove(
'&');
620 if ( appname.compare(i18n(
"Other...")) == 0 ) {
622 KOpenWithDlg dlg(list);
624 KRun::run(*dlg.service(), list);
628 TQString qry = TQString(
"((Type == 'Application') and (Name == '%1'))").arg( appname.latin1() );
629 KMimeType::Ptr mime = KMimeType::findByURL( m_viewManager->activeView()->getDoc()->url() );
630 TDETrader::OfferList offers = TDETrader::self()->query(mime->name(), qry);
632 if (!offers.isEmpty()) {
633 KService::Ptr app = offers.first();
634 KRun::run(*app, list);
637 KMessageBox::error(
this, i18n(
"Application '%1' not found!").arg(appname.latin1()), i18n(
"Application Not Found!"));
640 void KateMainWindow::pluginHelp()
642 KateApp::self()->invokeHelp (TQString::null,
"kate-plugins");
645 void KateMainWindow::slotMail()
658 TQPtrListIterator<Kate::Document> it(attDocs);
659 for ( ; it.current(); ++it ) {
662 if ( doc->url().isEmpty() ) {
664 int r = KMessageBox::questionYesNo(
this,
665 i18n(
"<p>The current document has not been saved, and "
666 "cannot be attached to an email message."
667 "<p>Do you want to save it and proceed?"),
668 i18n(
"Cannot Send Unsaved File"),KStdGuiItem::saveAs(),KStdGuiItem::cancel() );
669 if ( r == KMessageBox::Yes ) {
670 Kate::View *v = (Kate::View*)doc->views().first();
671 int sr = v->saveAs();
672 if ( sr == Kate::View::SAVE_OK ) { ;
675 if ( sr != Kate::View::SAVE_CANCEL )
676 KMessageBox::sorry(
this, i18n(
"The file could not be saved. Please check "
677 "if you have write permission.") );
684 if ( doc->isModified() ) {
686 int r = KMessageBox::warningYesNoCancel(
this,
687 i18n(
"<p>The current file:<br><strong>%1</strong><br>has been "
688 "modified. Modifications will not be available in the attachment."
689 "<p>Do you want to save it before sending it?").arg(doc->url().prettyURL()),
690 i18n(
"Save Before Sending?"), KStdGuiItem::save(), i18n(
"Do Not Save") );
692 case KMessageBox::Cancel:
694 case KMessageBox::Yes:
696 if ( doc->isModified() ) {
697 KMessageBox::sorry(
this, i18n(
"The file could not be saved. Please check "
698 "if you have write permission.") );
707 urls << doc->url().url();
709 if ( ! urls.count() )
720 void KateMainWindow::tipOfTheDay()
722 KTipDialog::showTip(
this, TQString::null,
true );
725 void KateMainWindow::slotFullScreen(
bool t)
733 void KateMainWindow::updateGrepDir (
bool visible)
739 if ( m_viewManager->activeView() )
741 if ( m_viewManager->activeView()->getDoc()->url().isLocalFile() )
743 greptool->updateDirName( m_viewManager->activeView()->getDoc()->url().directory() );
748 bool KateMainWindow::event( TQEvent *e )
750 uint type = e->type();
751 if ( type == TQEvent::WindowActivate && modNotification )
753 showModOnDiskPrompt();
755 return KateMDI::MainWindow::event( e );
758 bool KateMainWindow::showModOnDiskPrompt()
762 DocVector list( KateDocManager::self()->documents() );
764 for( doc = KateDocManager::self()->firstDocument(); doc; doc = KateDocManager::self()->nextDocument() )
766 if ( KateDocManager::self()->documentInfo( doc )->modifiedOnDisc )
768 list.insert( cnt, doc );
773 if ( cnt && !m_modignore )
778 bool res = mhdlg.exec();
786 void KateMainWindow::slotDocumentCreated (Kate::Document *doc)
788 connect(doc,TQT_SIGNAL(modStateChanged(Kate::Document *)),
this,TQT_SLOT(updateCaption(Kate::Document *)));
789 connect(doc,TQT_SIGNAL(nameChanged(Kate::Document *)),
this,TQT_SLOT(slotNameChanged(Kate::Document *)));
790 connect(doc,TQT_SIGNAL(nameChanged(Kate::Document *)),
this,TQT_SLOT(slotUpdateOpenWith()));
795 void KateMainWindow::slotNameChanged(Kate::Document *doc)
798 if (!doc->url().isEmpty())
799 fileOpenRecent->addURL(doc->url());
802 void KateMainWindow::updateCaption (Kate::Document *doc)
804 if (!m_viewManager->activeView())
806 setCaption (
"",
false);
810 if (!(m_viewManager->activeView()->getDoc() == doc))
814 if (m_viewManager->activeView()->getDoc()->url().isEmpty() || (!m_viewManager->getShowFullPath()))
816 c = m_viewManager->activeView()->getDoc()->docName();
820 c = m_viewManager->activeView()->getDoc()->url().prettyURL();
824 if ( !sessName.isEmpty() )
825 sessName = TQString(
"%1: ").arg( sessName );
827 setCaption( sessName + KStringHandler::lsqueeze(c,64),
828 m_viewManager->activeView()->getDoc()->isModified());
831 void KateMainWindow::saveProperties(TDEConfig *config)
833 TQString grp=config->group();
835 saveSession(config, grp);
836 m_viewManager->saveViewConfiguration (config, grp);
838 config->setGroup(grp);
841 void KateMainWindow::readProperties(TDEConfig *config)
843 TQString grp=config->group();
845 startRestore(config, grp);
847 m_viewManager->restoreViewConfiguration (config, grp);
849 config->setGroup(grp);
852 void KateMainWindow::saveGlobalProperties( TDEConfig* sessionConfig )
854 KateDocManager::self()->saveDocumentList (sessionConfig);
856 sessionConfig->setGroup(
"General");
857 sessionConfig->writeEntry (
"Last Session",
KateApp::self()->sessionManager()->activeSession()->sessionFileRelative());