=begin
  @short Main window class
  @author Diego 'Flameeyes' Pettenò <flameeyes@gentoo.org>
  @version 0.1
=end

class Jultagger < KDE::MainWindow
    slots 'tagsModified()',
        'tagsSaved()'

    def initialize()
        super( nil, "Jultagger" )
        @view = JultaggerView.new(self)
        connect(@view, SIGNAL( "modified()" ), self, SLOT( "tagsModified()" ))
        connect(@view, SIGNAL( "saved()" ), self, SLOT( "tagsSaved()" ))

        setAcceptDrops(false)

        setCentralWidget(@view)
        setupActions()
        statusBar.show()
        statusBar.sizePolicy = Qt::SizePolicy.new(Qt::SizePolicy::Ignored, Qt::SizePolicy::Fixed)
        statusBar.minimumHeight = 20
        statusBar.maximumHeight = 20

        @modified_icon = Qt::Label.new(self, "modified_icon");
        @modified_icon.minimumSize = Qt::Size.new(20, 20)
        @modified_icon.maximumSize = Qt::Size.new(20, 20)
        @modified_icon.alignment = Qt::AlignCenter
        statusBar.addWidget(@modified_icon, 0, true)

        setupGUI()
    end

    def setupActions()
        KDE::StdAction.quit($kapp, SLOT('quit()'), actionCollection())
        @save_action = KDE::StdAction.save(@view, SLOT('saveTags()'), actionCollection())
        @save_action.enabled = false
#         KDE::StdAction.preferences(self, SLOT('optionsPreferences()'), actionCollection())
    end

    def tagsModified()
        @modified_icon.pixmap = KDE::Global.iconLoader.loadIcon("filesave", KDE::Icon::Small)
        @save_action.enabled = true
    end

    def tagsSaved()
        @modified_icon.clear()
        @save_action.enabled = false
    end
end

## Kate modeline: leave at the end
# kate: indent-width 4; replace-trailing-space-save 1; space-indent 1; backspace-indents 1; indent-mode normal;
